diff --git a/app/assets/javascripts/rss.js b/app/assets/javascripts/rss.js index 737b08b7..5c17622f 100644 --- a/app/assets/javascripts/rss.js +++ b/app/assets/javascripts/rss.js @@ -384,14 +384,12 @@ modalWindow : function(settings,callbackFn){ if(tempheight>maxheight) tempheight=maxheight; }else{tempheight="auto";} - if(typeof tempwidth!="undefined"){ if(tempwidth.charAt(tempwidth.length-1)=='%') tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; if(tempwidth>maxwidth) tempwidth=maxwidth; }else{tempwidth="auto";} - $rss("body").append('
'); $rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.5,'z-index':199}); $rss("body").append('
'); @@ -400,7 +398,7 @@ modalWindow : function(settings,callbackFn){ var rgWLeft = (rgmaskWidth-20)/2; $rss("#rgWindow").css({top:rgWTop+"px", left:rgWLeft+"px"}); if(typeof settings.loadDiv!="undefined"){ - dhtml = $rss("#"+settings.loadDiv).html(); + dhtml = $rss(settings.loadDiv).html(); $rss("#rgWindow").html(dhtml).hide(); prepareWindow(); } @@ -416,7 +414,7 @@ modalWindow : function(settings,callbackFn){ if(tempheight!="auto") rgWTop = (rgmaskHeight-tempheight)/2; else{ - tempheight=$rss("#rgWindow").height(); + tempheight=$rss("#rgWindow").height()+30; if(tempheight>maxheight) tempheight=maxheight; rgWTop=(rgmaskHeight-tempheight)/2; @@ -451,7 +449,7 @@ modalWindow : function(settings,callbackFn){ $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();});}) if(typeof callbackFn=="function") - callbackFn.call(this,dhtml); + callbackFn.call(this,$rss("#rgWindow")); }); } }, diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 93816d71..286ec1c4 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -1,4 +1,3 @@ - class DesktopController< ApplicationController layout 'desktop' before_filter :authenticate_user! diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 73b5191a..e0028938 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -75,3 +75,4 @@ <%#= content_tag :li, link_to(t('admin.tags'), admin_asset_tags_path), :class => active_for_action('/admin/asset_tags', 'index') %> <%# end -%> <%# end -%> + diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js new file mode 100644 index 00000000..a683941f --- /dev/null +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery.js @@ -0,0 +1 @@ +//= require galleryAPI \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/gallery/.gitkeep b/vendor/built_in_modules/gallery/app/assets/javascripts/gallery/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js new file mode 100644 index 00000000..e05fb2eb --- /dev/null +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js @@ -0,0 +1,27 @@ +var galleryAPI = function(){ + g = this; + + this.initialize = function(){ + $(document).ready(function(){ + bindHandlers() + }) + var bindHandlers = function(){ + $("#gallery_panel a.btn").click(function(){ + rcom.modalWindow({loadDiv:"#"+$(this).attr("href"),width:"400"},function(dom){ + console.log(dom) + dom.find("#category_save_btn").click(function(){ + var lang = { + "en" : dom.find("#category_name_en").val(), + "zh_tw" : dom.find("#category_name_zh_tw").val() + } + $.post("gallery_category_save",{"category":lang},function(){ + + }) + return false; + }) + }); + return false; + }) + } + } +} \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb new file mode 100644 index 00000000..cbe9880b --- /dev/null +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb @@ -0,0 +1,11 @@ +class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController + + def index + end + + def new_category + GalleryCategory.create(language_value: params["category"]) + render :json=>{"success"=>"true"}.to_json + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/models/gallery_category.rb b/vendor/built_in_modules/gallery/app/models/gallery_category.rb new file mode 100644 index 00000000..17e98272 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/models/gallery_category.rb @@ -0,0 +1,6 @@ +class GalleryCategory + include Mongoid::Document + include Mongoid::Timestamps + + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy +end \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb new file mode 100644 index 00000000..2228143c --- /dev/null +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/index.html.erb @@ -0,0 +1,29 @@ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "galleryAPI" %> +<% end %> + + + + + \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/config/routes.rb b/vendor/built_in_modules/gallery/config/routes.rb index 1daf9a41..ae516d3f 100644 --- a/vendor/built_in_modules/gallery/config/routes.rb +++ b/vendor/built_in_modules/gallery/config/routes.rb @@ -1,2 +1,11 @@ Rails.application.routes.draw do + namespace :panel do + namespace :gallery do + namespace :back_end do + match "orbit_gallery" => "orbit_galleries#index" + match "gallery_category_save" => "orbit_galleries#new_category" + + end + end + end end