From cf864a7625eec755d47b2834cc7ed62954b6f85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 4 Apr 2021 13:03:24 +0800 Subject: [PATCH] add some modules --- app/assets/javascripts/gallery.js | 46 ++++- .../javascripts/galleryAPI_frontend.js.erb | 1 + app/assets/javascripts/theater.js | 10 +- app/assets/stylesheets/gallery.css | 38 ++-- app/assets/stylesheets/gallery_card.css | 91 +++++++++ app/assets/stylesheets/theater.css | 36 ++++ app/controllers/admin/galleries_controller.rb | 15 +- app/controllers/galleries_controller.rb | 53 ++++- app/models/album.rb | 27 ++- app/models/album_color.rb | 3 + app/models/album_image.rb | 14 +- app/models/album_setting.rb | 4 + app/uploaders/gallery_uploader.rb | 8 +- app/views/admin/galleries/_form.html.erb | 97 +++++---- app/views/admin/galleries/setting.html.erb | 85 +++++++- app/views/admin/galleries/show.html.erb | 22 ++- app/views/admin/images/show.html.erb | 2 +- app/views/galleries/show.html.erb | 186 +++++++++++++++++- config/locales/en.yml | 18 ++ config/locales/zh_tw.yml | 18 ++ lib/gallery/engine.rb | 37 ++++ modules/gallery/_gallery_widget3.html.erb | 33 ++++ modules/gallery/_gallery_widget4.html.erb | 38 ++++ modules/gallery/gallery_index5.html.erb | 32 +++ modules/gallery/info.json | 28 ++- modules/gallery/show.html.erb | 2 +- 26 files changed, 837 insertions(+), 107 deletions(-) create mode 100644 app/assets/stylesheets/gallery_card.css create mode 100644 modules/gallery/_gallery_widget3.html.erb create mode 100644 modules/gallery/_gallery_widget4.html.erb create mode 100644 modules/gallery/gallery_index5.html.erb diff --git a/app/assets/javascripts/gallery.js b/app/assets/javascripts/gallery.js index 7a1a561..ef8f7e9 100644 --- a/app/assets/javascripts/gallery.js +++ b/app/assets/javascripts/gallery.js @@ -188,8 +188,23 @@ function translate(ele,pretext,text,return_flag){ return return_value } } + $(function() { + var config = {} + config.autoGrow_minHeight = 50; + config.allowedContent = false; + config.disallowedContent = 'img'; + config.toolbar = [ + { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }, + { name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] }, + { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] }, + '/', + { name: 'insert', items: [ 'SpecialChar'] }, + { name: 'styles', items: [ 'Font' ] }, + { name: 'colors', items: [ 'TextColor', 'BGColor' ] } + ]; + var $container = $('.gallery'), $containerData = $container.data(); $container.data("order-edit","0"); @@ -261,17 +276,34 @@ $(function() { })[0]; switch($e.attr("for")){ case "description": - if(obj.description){ - instance.find("textarea").each(function(){ - if(obj.description[$(this).attr("for")]) - $(this).val(obj.description[$(this).attr("for")]); - }) - } + instance.find(".description-editor").each(function(){ + var locale = $(this).attr("for") + $(this).html(obj.description ? obj.description[locale] : ''); + CKEDITOR.replace(this,config); + }) + + instance.find(".title-editor").each(function(){ + var locale = $(this).attr("for") + $(this).html(obj.title ? obj.title[locale] : ''); + CKEDITOR.replace(this,config); + }) + instance.find("a[data-toggle=\"tab\"],div[role=\"tabpanel\"]").each(function(){ + $(this).attr('id',$(this).attr('id').replace('-fake','')) + }) instance.find("input[type=hidden]").val(image_id); instance.find("form").bind("ajax:success",function(evt, data, status){ $.pageslide.close(); photosData = data; }) + instance.find('.btn-group a[data-toggle="tab"]').click(function(){ + $(this).tab('show'); + $(this).parents('.btn-group').eq(0).children('a[data-toggle="tab"]').removeClass('active in'); + $(this).addClass('active in') + var inst = $($(this).attr('href')).find('textarea') + window.setTimeout(function(){ + CKEDITOR.instances[inst.attr('name')].execCommand('autogrow') + },300) + }) break; case "tags": instance.find('.tags-groups').cardCheck({ @@ -323,6 +355,7 @@ $(function() { if($("#imgholder").length){ $('.open').pageslide({ + W: '40vw', loadComplete: function(instance,elem) { bindEvent(instance,elem); } @@ -464,6 +497,7 @@ $(function() { $("#imgholder").prepend($e); $os = $e.find("a.open"); $os.pageslide({ + W: '40vw', loadComplete: function(instance,elem) { bindEvent(instance,elem); } diff --git a/app/assets/javascripts/galleryAPI_frontend.js.erb b/app/assets/javascripts/galleryAPI_frontend.js.erb index 5201279..a3164b5 100644 --- a/app/assets/javascripts/galleryAPI_frontend.js.erb +++ b/app/assets/javascripts/galleryAPI_frontend.js.erb @@ -4,6 +4,7 @@ $.extend($.expr[':'], { return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; } }); + var galleryAPI = function(){ g = this; this.urlVars = rcom.getUrlVars(); diff --git a/app/assets/javascripts/theater.js b/app/assets/javascripts/theater.js index 0ba6a19..a76d656 100644 --- a/app/assets/javascripts/theater.js +++ b/app/assets/javascripts/theater.js @@ -1,3 +1,8 @@ +$('.show-gallery .show-content.col-sm-2').ready(function(){ + if ($('.show-gallery .show-content.col-sm-2').eq(0).css('float')=='left'){ + $('.show-gallery .show-content.col-sm-2').eq(0).parent().css('float','left') + } +}) window.GalleryTheater = function(){ var parent_divs = $('.gallery').parents('div'), parent_div_z_index = parent_divs.eq(parent_divs.length-1).css('z-index') @@ -476,7 +481,10 @@ window.GalleryTheater = function(){ }else{ img.width("65%"); } - } + } + if (typeof set_gallery_height != 'undefined'){ + set_gallery_height() + } } var changeUrl = function(){ diff --git a/app/assets/stylesheets/gallery.css b/app/assets/stylesheets/gallery.css index 9dcedf3..bdda4c1 100644 --- a/app/assets/stylesheets/gallery.css +++ b/app/assets/stylesheets/gallery.css @@ -4,7 +4,7 @@ list-style: none; } #orbit_gallery .rgalbum { - position: relative; + position: relative; float: left; margin: 5px; padding: 5px; @@ -12,14 +12,14 @@ background: #FFFFFF; overflow: hidden; -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); - -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); - box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); - -o-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -o-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); -webkit-transition-property: left, right, top; - -moz-transition-property: left, right, top; - -ms-transition-property: left, right, top; - -o-transition-property: left, right, top; - transition-property: left, right, top; + -moz-transition-property: left, right, top; + -ms-transition-property: left, right, top; + -o-transition-property: left, right, top; + transition-property: left, right, top; } #orbit_gallery .rgalbum:hover { box-shadow: 0px 0px 5px rgba(0,0,0,.2); @@ -536,17 +536,19 @@ div.rgbody{ #fileupload #file-list .action-bnt { text-align: right; } - +.cke_contents.cke_reset{ + position: relative; +} .order-edit-notification{ background-color: #ffffd5; z-index: 10; - display: none; - height: 25px; - margin-left: 40%; - position: fixed; - text-align: center; - margin-top: 5px; - top: 85px; - width: 250px; - font-size: 13px; + display: none; + height: 25px; + margin-left: 40%; + position: fixed; + text-align: center; + margin-top: 5px; + top: 85px; + width: 250px; + font-size: 13px; } \ No newline at end of file diff --git a/app/assets/stylesheets/gallery_card.css b/app/assets/stylesheets/gallery_card.css new file mode 100644 index 0000000..db533f9 --- /dev/null +++ b/app/assets/stylesheets/gallery_card.css @@ -0,0 +1,91 @@ +.gallery.card-group .row { + position: relative; + display: flex; + flex-wrap: wrap; +} +.gallery.card-group .card-back { + transform: rotateY(180deg) translateX(-100%); + position: absolute; + backface-visibility: hidden; + transition: transform 300ms; + transition-timing-function: linear; + display: block; + width: 100%; + height: 100%; + top: 0; + background: white; + color: black; +} +.gallery.card-group .card.card-flip.h-100:nth-child(4n) { + margin-right: 0em; +} + +.gallery.card-group .card.card-flip.h-100 { + position: relative; + overflow: hidden; + width: 25%; + width: calc( 25% - 0.75em); + background: white; + margin-right: 1em; + margin-bottom: 1em; +} +@media (max-width: 768px){ + .gallery.card-group .card.card-flip.h-100 { + width: 50%; + width: calc( 50% - 0.5em); + } + .gallery.card-group .card.card-flip.h-100:nth-child(2n) { + margin-right: 0em; + } +} +@media (max-width: 575px){ + .gallery.card-group .card.card-flip.h-100 { + width: 100%; + margin-right: 0em; + } +} +.gallery.card-group h3.card-title { + padding: 0.5em; + margin: 0; + font-size: 1.2em; +} +.gallery.card-group .card-front{ + backface-visibility: hidden; + width: 100%; + height: 100%; +} +.gallery.card-group .card.card-flip.h-100:hover .card-back { + transform: rotateY(0deg); +} +.gallery.card-group .card-button-group{ + bottom: 0; + right: 0; + position: absolute; + display: flex; +} +.gallery.card-group .card-body{ + width: 100%; + position: inherit; + display: flex; + flex-direction: column; + height: 100%; +} +.gallery.card-group .card-button-group a { + color: #fff; + display: block; + background: #6c757d; + padding: 0.5em; + width: 2.3em; + height: 2.3em; + margin-right: 0.1em; + border-radius: 0; +} +.gallery.card-group .card-button-group a:hover { + color: #fff; + background-color: #5a6268; + border-color: #545b62; +} +.gallery.card-group .card-button-group a:focus { + color: #fff; + outline: 0.1em dotted !important; +} \ No newline at end of file diff --git a/app/assets/stylesheets/theater.css b/app/assets/stylesheets/theater.css index 51485fb..fb7f2f3 100644 --- a/app/assets/stylesheets/theater.css +++ b/app/assets/stylesheets/theater.css @@ -497,4 +497,40 @@ right:0; } #theaterPreviousButton{ left:0; +} + +.show-gallery-2 .gallery-thumb-container{ + overflow: hidden; +} +.show-gallery-2 img.gallery-image{ + position: absolute; +} +.show-gallery-2 .image-container{ + position: relative; + height: 100%; + width: 100%; +} +#gallery-theater-stage > .show-gallery-2.gallery{ + position: relative; + height: 0; + width: 100%; + z-index: unset; + overflow: hidden; +} +.show-gallery-2 .gallery-thumb-container{ + position: absolute; +} +.show-gallery-2 .gallery-image { + top: 42%; +} +.show-gallery-2 .gallery-actions{ + display: none; +} +.show-gallery-2 .gallery-img-desc{ + position: absolute; +} +@media screen and (max-width: 768px){ + .show-gallery-2 .gallery-thumb-container { + bottom: 0px; + } } \ No newline at end of file diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index 56f2021..5aeab81 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -281,10 +281,12 @@ class Admin::GalleriesController < OrbitAdminController @fiter_albums = albums1.concat(albums2) end def update_album_setting - AlbumSetting.first.update_attributes(limit: params['album_setting_limit']) + params_album_setting = params['album_setting'].permit! + AlbumSetting.first.update_attributes(params_album_setting) redirect_to '/admin/galleries' end def setting + @album_setting = AlbumSetting.first end def index album_length = Album.all.count @@ -297,13 +299,6 @@ class Admin::GalleriesController < OrbitAdminController end end @url = request.original_fullpath - if AlbumSetting.first.nil? - AlbumSetting.create() - elsif AlbumSetting.count > 1 - AlbumSetting.all.to_a[1..-1].each do |album_setting| - album_setting.destroy - end - end @limit_count = AlbumSetting.first.limit.to_i @limit_count = album_length if @limit_count == 0 if params['page_no'].nil? @@ -336,7 +331,7 @@ class Admin::GalleriesController < OrbitAdminController @images = @images.concat(images) image_content = [] @images.each do |image| - image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} + image_content << {"id" => image.id.to_s,"title"=> image.title_translations, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} end @tags = @module_app.tags @photos_data = {"galleries" => image_content}.to_json @@ -419,7 +414,7 @@ class Admin::GalleriesController < OrbitAdminController @images = @images.concat(images) image_content = [] @images.each do |image| - image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} + image_content << {"id" => image.id.to_s,"title"=> image.title_translations, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} end render :json=>{"galleries" => image_content}.to_json end diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index e5ee95d..4c37807 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -1,4 +1,5 @@ class GalleriesController < ApplicationController + find_tag = Tag.all.select{|value| value.name==I18n.t('gallery.not_show_desc')} if find_tag.length==0 module_app_id = ModuleApp.where(:key=>"gallery").first[:_id] @@ -35,6 +36,7 @@ class GalleriesController < ApplicationController end def index + @album_setting = AlbumSetting.first params = OrbitHelper.params album_tp = Album.filter_by_categories.filter_by_tags all_count = album_tp.count @@ -57,15 +59,19 @@ class GalleriesController < ApplicationController albums_no_order = album_tp.desc(:created_at).where(:order.in=>[-1,nil]).page(nil).per(all_count)[start_index...(start_index+page_data_count)].to_a end albums = albums_with_order.concat(albums_no_order) + album_color_map = AlbumColor.where(:album_id.in=> albums.map{|v| v.id}).pluck(:album_id,:color,:album_card_background_color,:album_card_text_color).map{|v| [v[0],v[1..-1]]}.to_h galleries = albums.collect do |a| doc = Nokogiri::HTML(a.description.to_s) alt_text = doc.text.empty? ? 'gallery image' : doc.text + colors = album_color_map[a.id] { "album-name" => a.name, "album-description" => a.description, "alt_title" => alt_text, "link_to_show" => OrbitHelper.url_to_show(a.to_param), - "thumb-src" => a.cover_path || "/assets/gallery/default.jpg" + "thumb-src" => a.cover_path || "/assets/gallery/default.jpg", + "album_color" => iterate_data(colors[1],colors[0],@album_setting.album_card_background_color,'transparent'), + "album_card_text_color" => iterate_data(colors[2],@album_setting.album_card_text_color) } end { @@ -75,16 +81,25 @@ class GalleriesController < ApplicationController } end def show + @album_setting = AlbumSetting.first params = OrbitHelper.params album = Album.find_by_param(params[:uid]) flag = show_desc? + colors = AlbumColor.where(:album_id=> album.id).pluck(:color,:album_card_background_color,:album_card_text_color)[0] rescue [] images = album.album_images.asc(:order).collect do |a| - alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) + alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description.to_s).text()) { "image-description" => (flag ? a.description : ''), + "image_short_description" => a.title, "alt_title" => alt_text, "link_to_show" => "#" + a.id.to_s, - "thumb-src" => a.file.thumb.url + "thumb-src" => a.file.thumb.url, + "thumb-large-src" => a.file.thumb_large.url, + "mobile-src" => a.file.mobile.url, + "theater-src" => a.file.theater.url, + + "album_color" => iterate_data(colors[1],colors[0],@album_setting.album_card_background_color,'transparent'), + "album_card_text_color" => iterate_data(colors[2],@album_setting.album_card_text_color) } end { @@ -93,14 +108,27 @@ class GalleriesController < ApplicationController "album-description" => (flag ? "

#{album.description}

" : "")} } end + def iterate_data(*args) + tmp = nil + args.each do |arg| + if !arg.blank? && arg != 'transparent' + tmp = arg + break + end + end + tmp + end def widget + @album_setting = AlbumSetting.first tags = OrbitHelper.widget_tags.empty? ? ["all"] : OrbitHelper.widget_tags album_ids = Album.filter_by_widget_categories(OrbitHelper.widget_categories,false).filter_by_tags(tags).pluck(:id) + album_color_map = AlbumColor.where(:album_id.in=> album_ids).pluck(:album_id,:color,:album_card_background_color,:album_card_text_color).map{|v| [v[0],v[1..-1]]}.to_h params = OrbitHelper.params counts = OrbitHelper.widget_data_count images = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts) images = images.collect do |a| - alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) + colors = album_color_map[a.album_id] + alt_text = (a.description.nil? || a.description == "" ? "gallery image" : Nokogiri::HTML(a.description).text()) { "link_to_show" => OrbitHelper.widget_more_url + "/" + a.album.to_param + "#" + a.id.to_s, "alt_title" => alt_text, @@ -108,9 +136,12 @@ class GalleriesController < ApplicationController "thumb-src" => a.file.thumb.url, "thumb-large-src" => a.file.thumb_large.url, "image_description" => a.description, + "image_short_description" => a.title, "mobile-src" => a.file.mobile.url, "theater-src" => a.file.theater.url, - "album-name" => a.album.name_translations[I18n.locale] + "album-name" => a.album.name_translations[I18n.locale], + "album_color" => iterate_data(colors[1],colors[0],@album_setting.album_card_background_color,'transparent'), + "album_card_text_color" => iterate_data(colors[2],@album_setting.album_card_text_color) } end { @@ -137,9 +168,15 @@ class GalleriesController < ApplicationController return output end def theater - image = AlbumImage.find(params[:id]) - albumid = image.album_id - album = Album.find(albumid) + if params[:id].include?('page=') + album = Album.where(uid: params[:id].sub('page=','')).first + albumid = album.id + image = album.album_images.first + else + image = AlbumImage.find(params[:id]) + albumid = image.album_id + album = Album.find(albumid) + end images = album.album_images.asc(:order) data = { "album" => album, diff --git a/app/models/album.rb b/app/models/album.rb index 66486b4..b945f09 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -5,7 +5,6 @@ class Album include OrbitCategory::Categorizable include OrbitTag::Taggable include Slug - field :name, as: :slug_title, localize: true field :description, localize: true field :cover, default: "default" @@ -14,7 +13,7 @@ class Album field :uid, type: String field :rss2_id, type: String field :order, type: Integer, default: -1 - + field :resize_gravity # has_and_belongs_to_many :tags, :class_name => "GalleryTag" has_many :album_images, :autosave => true, :dependent => :destroy has_many :album_colors, :autosave => true, :dependent => :destroy @@ -30,6 +29,30 @@ class Album end end end + def resize_gravity + """ + NorthWestGravity + Position object at top-left of region + NorthGravity + Position object at top-center of region + NorthEastGravity + Position object at top-right of region + WestGravity + Position object at left-center of region + CenterGravity + Position object at center of region + EastGravity + Position object at right-center of region + SouthWestGravity + Position object at left-bottom of region + SouthGravity + Position object at bottom-center of region + SouthEastGravity + Position object at bottom-right of region + """ + tmp = self[:resize_gravity] + (tmp.blank? ? AlbumSetting.first.resize_gravity : tmp) rescue 'Center' + end def self.find_by_param(input) self.find_by(uid: input) end diff --git a/app/models/album_color.rb b/app/models/album_color.rb index 1295e00..341fcb9 100644 --- a/app/models/album_color.rb +++ b/app/models/album_color.rb @@ -2,5 +2,8 @@ class AlbumColor include Mongoid::Document include Mongoid::Timestamps field :color, type: String + field :album_card_background_color, type: String + field :album_card_text_color, type: String + belongs_to :album end \ No newline at end of file diff --git a/app/models/album_image.rb b/app/models/album_image.rb index 17cb56a..6379792 100644 --- a/app/models/album_image.rb +++ b/app/models/album_image.rb @@ -5,12 +5,22 @@ class AlbumImage include OrbitTag::Taggable mount_uploader :file, GalleryUploader field :title + field :title_translations, type: Hash, default: {} field :description, localize: true field :rss2_id, type: String field :order, type: Integer, default: -1 - + # has_and_belongs_to_many :tags, :class_name => "GalleryTag" - + def title_translations + tmp = super || {} + if tmp == {} + tmp = I18n.available_locales.collect{|locale| [locale,self[:title]]}.to_h + end + tmp + end + def title + self.title_translations[I18n.locale] + end belongs_to :album has_many :album_crops, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :album_crops, :allow_destroy => true diff --git a/app/models/album_setting.rb b/app/models/album_setting.rb index fc6a41e..a87e0f4 100644 --- a/app/models/album_setting.rb +++ b/app/models/album_setting.rb @@ -2,4 +2,8 @@ class AlbumSetting include Mongoid::Document include Mongoid::Timestamps field :limit + field :resize_gravity, type: String, default: 'center' + ResizeGravities = %w[Center NorthWest North NorthEast West East SouthWest South SouthEast] + field :album_card_background_color, default: '' + field :album_card_text_color, default: '#000000' end \ No newline at end of file diff --git a/app/uploaders/gallery_uploader.rb b/app/uploaders/gallery_uploader.rb index 05e8b6f..d4cb222 100644 --- a/app/uploaders/gallery_uploader.rb +++ b/app/uploaders/gallery_uploader.rb @@ -172,14 +172,12 @@ class GalleryUploader < CarrierWave::Uploader::Base img.write(model.file.crop_from_org.path) end def transparent?(*arg) - now_id = model.album_id.to_s - now_album = Album.all.select { |value| (now_id==value.id.to_s)}[0] + now_album = model.album now_album.album_colors.first['color']=='transparent' rescue true end def pad_process (w,h) - now_id = model.album_id.to_s - now_album = Album.all.select { |value| (now_id==value.id.to_s)}[0] - resize_and_pad(w, h, ((now_album.album_colors.first['color']=='transparent' rescue true) ? :transparent : now_album.album_colors.first['color']), 'Center') + now_album = model.album + resize_and_pad(w, h, (transparent? ? :transparent : now_album.album_colors.first['color']), (now_album.resize_gravity rescue 'Center')) end end diff --git a/app/views/admin/galleries/_form.html.erb b/app/views/admin/galleries/_form.html.erb index 77898af..2c734c5 100644 --- a/app/views/admin/galleries/_form.html.erb +++ b/app/views/admin/galleries/_form.html.erb @@ -22,42 +22,45 @@ input.minicolors-input{ max-width: 90%; } -
@@ -116,6 +119,30 @@ input.minicolors-input{ <%= t('gallery.transparent') %> +
+ + <%= album_color_form.text_field :album_card_background_color, :class => 'input-block-level minicolors-input' %> + + + <%= t('gallery.transparent') %> + +
+
+ + <%= album_color_form.text_field :album_card_text_color, :class => 'input-block-level minicolors-input' %> + + + <%= t('gallery.transparent') %> + +
+
+ +
+ <%= f.select :resize_gravity, [["---#{t("default")}: #{t("gallery.gravity.#{AlbumSetting::ResizeGravities[0]}")}---",nil]]+AlbumSetting::ResizeGravities.collect{|v| [t("gallery.gravity.#{v}"),v]} %> +
+
<% end %> diff --git a/app/views/admin/galleries/setting.html.erb b/app/views/admin/galleries/setting.html.erb index 1761e5c..1df7a8e 100644 --- a/app/views/admin/galleries/setting.html.erb +++ b/app/views/admin/galleries/setting.html.erb @@ -1,12 +1,79 @@ +<%= javascript_include_tag "jquery.minicolors" %> +<%= stylesheet_link_tag "jquery.minicolors" %> + -<%= form_tag '/admin/galleries/update_album_setting',remote: true,:class=>'update_album_setting_form' do %> - <%= t('gallery.album_limit_for_one_page') %>: - <%= text_field_tag :album_setting_limit, AlbumSetting.first.limit,:placeholder => t('gallery.blank_for_nil') %> - +<%= form_for @album_setting, url: '/admin/galleries/update_album_setting',:class=>'update_album_setting_form',method: 'post' do |f| %> +
+ + <%= f.text_field :limit,:placeholder => t('gallery.blank_for_nil') %> +
+
+ + <%= f.select :resize_gravity, [["---#{t("default")}: #{t("gallery.gravity.#{AlbumSetting::ResizeGravities[0]}")}---",nil]]+AlbumSetting::ResizeGravities.collect{|v| [t("gallery.gravity.#{v}"),v]} %> +
+
+ + <%= f.text_field :album_card_background_color, :class => 'input-block-level minicolors-input' %> + + + <%= t('gallery.transparent') %> + +
+
+ + <%= f.text_field :album_card_text_color, :class => 'input-block-level minicolors-input' %> + + + <%= t('gallery.transparent') %> + +
+ + <%= f.hidden_field :id %> + <%= f.submit t('submit'),:class=>'btn btn-primary' %> <% end %> \ No newline at end of file diff --git a/app/views/admin/galleries/show.html.erb b/app/views/admin/galleries/show.html.erb index b9806d7..bb926ab 100644 --- a/app/views/admin/galleries/show.html.erb +++ b/app/views/admin/galleries/show.html.erb @@ -164,11 +164,22 @@
- Description - <% @site_in_use_locales.each_with_index do |locale, i| %> - - - <% end %> +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= t(locale) %> + <% end %> +
+
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + <%= I18n.t('description') %> + + + <%= I18n.t('gallery.short-description') %> + +
+ <% end %> +
<%= t('gallery.cancel') %> @@ -184,7 +195,6 @@ <% content_for :page_specific_javascript do %> - <%= javascript_include_tag "lib/jquery-ui-1.10.0.custom.min" %> <%= javascript_include_tag "jquery.masonry.min.js" %> <%= javascript_include_tag "jquery.lite.image.resize.js" %> <%= javascript_include_tag "lib/checkbox.card" %> diff --git a/app/views/admin/images/show.html.erb b/app/views/admin/images/show.html.erb index 500c2d3..3358318 100644 --- a/app/views/admin/images/show.html.erb +++ b/app/views/admin/images/show.html.erb @@ -24,7 +24,7 @@ List F
- <%= @image.description %> + <%= @image.description.html_safe %>
diff --git a/app/views/galleries/show.html.erb b/app/views/galleries/show.html.erb index 9cf75dd..6104c56 100644 --- a/app/views/galleries/show.html.erb +++ b/app/views/galleries/show.html.erb @@ -1,10 +1,194 @@ +<% + params = OrbitHelper.params + page = Page.where(url:params['url']).first + @layout_type = 0 + if page.methods.include?(:select_option_items) + @show_option_items = ModuleApp.where(key: 'gallery').last.show_option_items rescue nil + page.select_option_items.each do |select_option_item| + if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s + value = YAML.load(select_option_item.value) + tmp = value[:en] + I18n.with_locale(:en) do + if tmp == t('gallery.grid_style') + @layout_type = 0 + elsif tmp == t('gallery.card_style') + @layout_type = 1 + elsif tmp == t('gallery.slideshow_style') + @layout_type = 2 + end + end + end + end + end + data = action_data +%> +<% if @layout_type==0 %> <%= render_view %> +<% elsif @layout_type==1 %> + + +<% elsif @layout_type==2 %> + +<% elsif @layout_type==nil %> + +<% end %> <% OrbitHelper.render_css_in_head(["theater.css"]) %> <%= javascript_include_tag "jquery.touchSwipe.min" %> <%= javascript_include_tag "theater" %> <% OrbitHelper.render_meta_tags([{"name" => "mobile-web-app-capable","content" => "yes"},{"name" => "apple-mobile-web-app-status-bar-style","content" => "black-translucent"}]) %>