Commit b00b9ab00c6c1f4fd978f013b9d3886e203a0dc5

Authored by Karpikau Andrei
1 parent 1d582ad0

work on RTE and choose image

... ... @@ -1585,9 +1585,6 @@ jQuery(document).ready(function(){
1585 1585
1586 1586 var galleryUrl = $this.$original_element.data('gallery-url');
1587 1587
1588   -
1589   -
1590   -
1591 1588 jQuery.ajax({
1592 1589 type: 'POST',
1593 1590 url: galleryUrl,
... ... @@ -1606,6 +1603,12 @@ jQuery(document).ready(function(){
1606 1603 html: true,
1607 1604 trigger: 'manual',
1608 1605 placement: layer_position
  1606 + }).on('shown.bs.popover', function () {
  1607 + var $obj = $($(this).data("bs.popover").getTipElement());
  1608 + $obj.addClass('rte-popover');
  1609 + if(!$this.$original_element.froalaEditor('fullscreen.isActive')){
  1610 + $obj.css('left', '-490px');
  1611 + }
1609 1612 }).on('hidden.bs.popover', function () {
1610 1613 $popover.popover('dispose');
1611 1614 }).popover('show');
... ... @@ -1622,7 +1625,7 @@ jQuery(document).ready(function(){
1622 1625 var img_link = $(this).attr('href');
1623 1626
1624 1627 $this.$original_element.froalaEditor('image.insert', img_link, true, {});
1625   -
  1628 + $popover.popover('dispose');
1626 1629
1627 1630 return false;
1628 1631 });
... ...
... ... @@ -5318,6 +5318,7 @@ body .jvectormap-zoomout {
5318 5318 font-weight:bold;
5319 5319 }
5320 5320
  5321 +.mt-5{margin-top:5px;}
5321 5322 .mt-20{margin-top:20px;}
5322 5323
5323 5324 .dropleft.without-icon .dropdown-toggle::before{
... ... @@ -5375,4 +5376,19 @@ body .jvectormap-zoomout {
5375 5376 text-decoration: none;
5376 5377 outline: 0;
5377 5378 background-color: #428bca;
  5379 +}
  5380 +
  5381 +.rte-popover{
  5382 + max-width:600px;
  5383 + width:600px;
  5384 + z-index:9999;
  5385 + .popover-body{
  5386 + height:400px;
  5387 + overflow-y: auto;
  5388 + background-color:#f5f7fa;
  5389 +
  5390 + }
  5391 + .arrow:after{
  5392 + border-left-color:#f5f7fa;
  5393 + }
5378 5394 }
\ No newline at end of file
... ...
... ... @@ -55,7 +55,7 @@ module Kanjai
55 55 end
56 56
57 57 def get_gallery
58   - @collection = Image.all
  58 + @collection = Image.where(file_type: Kanjai::Image::IMAGE_MIME_TYPE)
59 59
60 60 render :layout => false
61 61 end
... ...
... ... @@ -4,6 +4,8 @@ module Kanjai
4 4
5 5 belongs_to :object, polymorphic: true, optional: true
6 6
  7 + IMAGE_MIME_TYPE = ['image/bmp', 'image/gif', 'image/jpeg', 'image/pipeg', 'image/svg+xml', 'image/png']
  8 +
7 9 # has_attached_file :image,
8 10 # :styles => {:mini => '200x200>'},
9 11 # :path => ":object_type/:object_id/images/:id/:style/:basename.:extension",
... ...
... ... @@ -4,7 +4,7 @@ module Kanjai
4 4
5 5 has_many :page_contents
6 6
7   - validates :title, :url, :page_id, :lang, presence: true
  7 + validates :title, :page_id, :lang, presence: true
8 8
9 9 serialize :template_content, Array
10 10
... ...
... ... @@ -22,6 +22,4 @@
22 22 </div>
23 23 </div>
24 24 <% end %>
25   -
26   -
27 25 </div>
... ...
1   -<div>
2   - <% @collection.each do |item| %>
3   - <a href="<%= item.image_link %>" class="gallery-item" style="display:inline-block;width:200px;height:200px;border:1px solid black;"><%= image_tag item.image_link, :style => 'display:inline-block;margin:0;padding:0;max-width:100px;' %></a>
4   - <% end %>
5   -</div>
  1 +<div class="card-columns">
  2 + <% @collection.each do |item| %>
  3 + <a href="<%= item.image_link %>" class="gallery-item">
  4 + <div class="card mb-4" >
  5 + <%= image_tag item.image_link, class: 'card-img-top img-fluid', alt: '' %>
  6 + </div>
  7 + </a>
  8 + <% end %>
  9 +</div>
\ No newline at end of file
... ...
... ... @@ -22,7 +22,7 @@
22 22 </div>
23 23
24 24 <div class="form-group row mt-2">
25   - <%= form.label :page_template_id, Kanjai::Page.human_attribute_name(:page_template_id), :class => "col-sm-2 control-label" %>
  25 + <%= form.label :page_template_id, Kanjai::Page.human_attribute_name(:page_template_id) + '*', :class => "col-sm-2 control-label" %>
26 26 <div class="col-sm-10">
27 27 <%= form.select :page_template_id, Kanjai::PageTemplate.all.collect{|p| [p[:title], p[:id]] }, {:include_blank => true}, :class => "form-control #{@page.errors.include?(:page_template) ? 'parsley-error' : ''}" %>
28 28 <%= error_messages(@page, :page_template) %>
... ... @@ -72,7 +72,7 @@
72 72 </div>
73 73
74 74 <div class="form-group row mt-2">
75   - <%= form2.label :url, Kanjai::Page.human_attribute_name(:url) + '*', :class => "col-sm-2 col-form-label" %>
  75 + <%= form2.label :url, Kanjai::Page.human_attribute_name(:url), :class => "col-sm-2 col-form-label" %>
76 76 <div class="col-sm-10">
77 77 <%= form2.text_field :url, :class => "form-control" %>
78 78 </div>
... ... @@ -83,9 +83,16 @@
83 83
84 84 <div class="card-footer mt-20">
85 85 <div class="clearfix">
86   - <div class="float-right">
87   - <%= link_to t('actions.cancel'), admin_pages_url, class: 'btn btn-secondary' %>
88   - <button class="btn btn-primary" type="submit"><%= t('actions.save') %></button>
  86 + <div class="row">
  87 + <div class="col-md-6">
  88 + <p class="mt-1">* Please at mandatory fields</p>
  89 + </div>
  90 + <div class="col-md-6">
  91 + <div class="float-right">
  92 + <%= link_to t('actions.cancel'), admin_pages_url, class: 'btn btn-secondary' %>
  93 + <button class="btn btn-primary" type="submit"><%= t('actions.save') %></button>
  94 + </div>
  95 + </div>
89 96 </div>
90 97 </div>
91 98 </div>
... ...
... ... @@ -12,7 +12,8 @@ Kanjai::Engine.routes.draw do
12 12 end
13 13
14 14 namespace :admin do
15   - get '/' => 'dashboard#index', as: 'dashboard'
  15 + #get '/' => 'dashboard#index', as: 'dashboard'
  16 + get '/' => 'pages#index', as: 'dashboard'
16 17
17 18
18 19 get 'configuration' => 'config#index', :as => :configuration
... ...
1 1 module Kanjai
2   - VERSION = "0.0.149"
  2 + VERSION = "0.0.150"
3 3 end
... ...