From 0b0916179fb5b6154eb19610ebdc426663bcb8c5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 16 May 2012 11:07:11 +0800 Subject: [PATCH 1/8] Change assets --- app/assets/javascripts/new_admin.js | 1 + app/assets/javascripts/tinymce_orbit.js | 97 +++++++++++++++---- .../admin/asset_categories_controller.rb | 65 +++++++++++++ app/controllers/admin/assets_controller.rb | 19 ++-- app/models/asset.rb | 3 + app/models/asset_category.rb | 16 +++ app/uploaders/asset_uploader.rb | 6 +- .../asset_categories/_asset_category.html.erb | 17 ++++ .../admin/asset_categories/_form.html.erb | 30 ++++++ .../admin/asset_categories/create.js.erb | 2 + .../admin/asset_categories/destroy.js.erb | 1 + app/views/admin/asset_categories/edit.js.erb | 1 + .../admin/asset_categories/index.html.erb | 41 ++++++++ app/views/admin/asset_categories/new.js.erb | 1 + .../admin/asset_categories/update.js.erb | 4 + app/views/admin/assets/_asset.html.erb | 21 ++-- app/views/admin/assets/_edit.html.erb | 2 +- app/views/admin/assets/_filter.html.erb | 11 +++ app/views/admin/assets/_form.html.erb | 5 + app/views/admin/assets/_sort_headers.html.erb | 5 + app/views/admin/assets/index.html.erb | 55 ++++++----- config/environments/development.rb | 3 + config/routes.rb | 7 +- .../back_end/bulletins/_form.html.erb | 4 +- 24 files changed, 346 insertions(+), 71 deletions(-) create mode 100644 app/controllers/admin/asset_categories_controller.rb create mode 100644 app/models/asset_category.rb create mode 100644 app/views/admin/asset_categories/_asset_category.html.erb create mode 100644 app/views/admin/asset_categories/_form.html.erb create mode 100644 app/views/admin/asset_categories/create.js.erb create mode 100644 app/views/admin/asset_categories/destroy.js.erb create mode 100644 app/views/admin/asset_categories/edit.js.erb create mode 100644 app/views/admin/asset_categories/index.html.erb create mode 100644 app/views/admin/asset_categories/new.js.erb create mode 100644 app/views/admin/asset_categories/update.js.erb create mode 100644 app/views/admin/assets/_filter.html.erb create mode 100644 app/views/admin/assets/_sort_headers.html.erb diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index f20267cd9..70bc22bd6 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -15,4 +15,5 @@ //= require tinymce_orbit //= require orbit-bar-search //= require side_bar_history +//= require rss //= require ajax_form \ No newline at end of file diff --git a/app/assets/javascripts/tinymce_orbit.js b/app/assets/javascripts/tinymce_orbit.js index 71264fde9..9e0853e3a 100644 --- a/app/assets/javascripts/tinymce_orbit.js +++ b/app/assets/javascripts/tinymce_orbit.js @@ -1,29 +1,90 @@ function load_tinymce() { $('.tinymce_textarea').tinymce({ + + // General options theme: 'advanced', - plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", + file_browser_callback : 'myFileBrowser', + plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", - // Theme options - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor", - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : true, + // Theme options + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", + theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor", + theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_statusbar_location : "bottom", + theme_advanced_resizing : true, - // Skin options - skin : "o2k7", - skin_variant : "silver", + // Skin options + skin : "o2k7", + skin_variant : "silver", - // Drop lists for link/image/media/template dialogs - template_external_list_url : "js/template_list.js", - external_link_list_url : "js/link_list.js", - external_image_list_url : "js/image_list.js", - media_external_list_url : "js/media_list.js" + // Drop lists for link/image/media/template dialogs + template_external_list_url : "js/template_list.js", + // external_link_list_url : "js/link_list.js", + // external_image_list_url : "js/image_list.js", + // media_external_list_url : "js/media_list.js" + + // Style formats + style_formats : [ + {title : 'Bold text', inline : 'b'}, + {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, + {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, + {title : 'Example 1', inline : 'span', classes : 'example1'}, + {title : 'Example 2', inline : 'span', classes : 'example2'}, + {title : 'Table styles'}, + {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} + ], + + // Replace values for the template plugin + template_replace_values : { + username : "Some User", + staffid : "991234" + } }); + function myFileBrowser (field_name, url, type, win) { + + + var cmsURL = window.location.toString(); + cmsURL = cmsURL.split("/"); + // cmsURL = "http:///modules/modules/filemanager/"; + + // script URL - use an absolute path! + if (cmsURL.indexOf("?") < 0) { + //add the type as the only query parameter + cmsURL = cmsURL + "?type=" + type; + } + else { + //add the type as an additional query parameter + // (PHP session ID is now included if there is one at all) + cmsURL = cmsURL + "&type=" + type; + } + + tinyMCE.activeEditor.windowManager.open({ + file : cmsURL, + title : 'File Browser', + width : 850, // Your dimensions may differ - toy around with them! + height : 455, + resizable : "no", + inline : "no", // This parameter only has an effect if you use the inlinepopups plugin! + close_previous : "no" + }, { + window : win, + input : field_name + }); + return false; + } + function ajaxSave() { + var ed = tinyMCE.get('content'); + // Do you ajax call here, window.setTimeout fakes ajax call + ed.setProgressState(1); // Show progress + window.setTimeout(function() { + ed.setProgressState(0); // Hide progress + alert(ed.getContent()); + }, 3000); + } } $(document).ready(function() { load_tinymce(); -}); \ No newline at end of file +}); diff --git a/app/controllers/admin/asset_categories_controller.rb b/app/controllers/admin/asset_categories_controller.rb new file mode 100644 index 000000000..22efd03f0 --- /dev/null +++ b/app/controllers/admin/asset_categories_controller.rb @@ -0,0 +1,65 @@ +class Admin::AssetCategoriesController < OrbitBackendController + + def index + @asset_categories = AssetCategory.all + @asset_category = AssetCategory.new + @url = admin_asset_categories_path + + end + + def show + @asset_category = AssetCategory.find(params[:id]) + end + + def new + @asset_category = AssetCategory.new + end + + def edit + @asset_category = AssetCategory.find(params[:id]) + @i18n_variable = @asset_category.i18n_variable + @url = admin_asset_categories_path(@asset_category) + end + + def create + @asset_category = AssetCategory.new(params[:asset_category]) + + respond_to do |format| + if @asset_category.save + format.html { redirect_to(admin_asset_categories_url, :notice => t('announcement.create_asset_category_success')) } + format.js + else + format.html { render :action => "new" } + format.js { render action: "new" } + end + end + end + + def update + @asset_category = AssetCategory.find(params[:id]) + + @url = admin_asset_categories_path(@asset_category) + + respond_to do |format| + if @asset_category.update_attributes(params[:asset_category]) + # format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('asset_category.update_asset_category_success')) } + # format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('asset_category.update_asset_category_success')) } + # format.xml { head :ok } + format.js + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + end + end + + def destroy + @asset_category = AssetCategory.find(params[:id]) + @asset_category.destroy + + respond_to do |format| + format.html { redirect_to(admin_asset_categories_url) } + format.js + end + end +end diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb index 1591cf39a..b595ed5bf 100644 --- a/app/controllers/admin/assets_controller.rb +++ b/app/controllers/admin/assets_controller.rb @@ -1,11 +1,7 @@ -class Admin::AssetsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :is_admin? +class Admin::AssetsController < OrbitBackendController def index - @assets = Asset.all.entries + @assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.page(params[:page]).per(10) end def show @@ -14,6 +10,7 @@ class Admin::AssetsController < ApplicationController def new @asset = Asset.new + @asset_categories = AssetCategory.all respond_to do |format| format.html {} format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} } @@ -22,6 +19,7 @@ class Admin::AssetsController < ApplicationController def edit @asset = Asset.find(params[:id]) + @asset_categories = AssetCategory.all respond_to do |format| format.html {} format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} } @@ -33,7 +31,7 @@ class Admin::AssetsController < ApplicationController if @asset.save respond_to do |format| format.html { redirect_to admin_assets_url } - format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'asset_tbody', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} } + format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'tbody_assets', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} } end else respond_to do |format| @@ -66,5 +64,12 @@ class Admin::AssetsController < ApplicationController format.js { render 'js/remove_element', :locals => {:id => "asset_#{@asset.id}"} } end end + + def delete + if params[:to_delete] + asset = Asset.any_in(:_id => params[:to_delete]).delete_all + end + redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end end diff --git a/app/models/asset.rb b/app/models/asset.rb index c44e8be14..2bb02dfcc 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -9,5 +9,8 @@ class Asset field :description validates_presence_of :filename, :data + + belongs_to :asset_category + belongs_to :assetable, polymorphic: true end diff --git a/app/models/asset_category.rb b/app/models/asset_category.rb new file mode 100644 index 000000000..89bceaf7b --- /dev/null +++ b/app/models/asset_category.rb @@ -0,0 +1,16 @@ +class AssetCategory + include Mongoid::Document + include Mongoid::Timestamps + + field :key + field :display + + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + + has_many :assets + + def self.from_id(id) + AssetCategory.find(id) rescue nil + end + +end \ No newline at end of file diff --git a/app/uploaders/asset_uploader.rb b/app/uploaders/asset_uploader.rb index 1e07bca6a..f59e20a09 100644 --- a/app/uploaders/asset_uploader.rb +++ b/app/uploaders/asset_uploader.rb @@ -48,8 +48,8 @@ class AssetUploader < CarrierWave::Uploader::Base # end # Override the filename of the uploaded files: - # def filename - # "something.jpg" if original_filename - # end + def filename + model.filename + end end diff --git a/app/views/admin/asset_categories/_asset_category.html.erb b/app/views/admin/asset_categories/_asset_category.html.erb new file mode 100644 index 000000000..d7047e36f --- /dev/null +++ b/app/views/admin/asset_categories/_asset_category.html.erb @@ -0,0 +1,17 @@ + + + + <%= asset_category.key %> +
+ +
+ + <% @site_valid_locales.each do |locale| %> + <%= asset_category.i18n_variable[locale] rescue nil %> + <% end %> + diff --git a/app/views/admin/asset_categories/_form.html.erb b/app/views/admin/asset_categories/_form.html.erb new file mode 100644 index 000000000..5c64146f0 --- /dev/null +++ b/app/views/admin/asset_categories/_form.html.erb @@ -0,0 +1,30 @@ +<% # encoding: utf-8 %> + +<%= form_for(@asset_category, :remote => true, :url => @url) do |f| %> + +

<%= (@asset_category.new_record? ? 'Add' : 'Edit') %>

+ +
+ <%= f.label :key %> + <%= f.text_field :key %> +
+ +
+ <%= f.fields_for :i18n_variable, (@asset_category.new_record? ? @asset_category.build_i18n_variable : @asset_category.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
+ <%= f.text_field locale, :class => 'input-xxlarge' %> +
+
+ <% end %> + <% end %> +
+ +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> +
+ +<% end %> + \ No newline at end of file diff --git a/app/views/admin/asset_categories/create.js.erb b/app/views/admin/asset_categories/create.js.erb new file mode 100644 index 000000000..8da391d7b --- /dev/null +++ b/app/views/admin/asset_categories/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'asset_category', :collection => [@asset_category] %>').appendTo('#asset_categories').hide().fadeIn(); +$("#new_asset_category")[0].reset(); \ No newline at end of file diff --git a/app/views/admin/asset_categories/destroy.js.erb b/app/views/admin/asset_categories/destroy.js.erb new file mode 100644 index 000000000..4c336e78a --- /dev/null +++ b/app/views/admin/asset_categories/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @asset_category %>").remove(); \ No newline at end of file diff --git a/app/views/admin/asset_categories/edit.js.erb b/app/views/admin/asset_categories/edit.js.erb new file mode 100644 index 000000000..eaff01fa3 --- /dev/null +++ b/app/views/admin/asset_categories/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); \ No newline at end of file diff --git a/app/views/admin/asset_categories/index.html.erb b/app/views/admin/asset_categories/index.html.erb new file mode 100644 index 000000000..f1d1a787d --- /dev/null +++ b/app/views/admin/asset_categories/index.html.erb @@ -0,0 +1,41 @@ + +<%= flash_messages %> + + + + + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + <%= render :partial => 'asset_category', :collection => @asset_categories %> + + +
+ +
<%= render :partial => "form" %>
+ + + diff --git a/app/views/admin/asset_categories/new.js.erb b/app/views/admin/asset_categories/new.js.erb new file mode 100644 index 000000000..40061b9fc --- /dev/null +++ b/app/views/admin/asset_categories/new.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/app/views/admin/asset_categories/update.js.erb b/app/views/admin/asset_categories/update.js.erb new file mode 100644 index 000000000..75ef202e3 --- /dev/null +++ b/app/views/admin/asset_categories/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @asset_category %>").replaceWith("<%= j render :partial => 'asset_category', :collection => [@asset_category] %>"); +<% @asset_category = AssetCategory.new(:display => 'List') # reset for new form %> +$(".edit_asset_category").replaceWith("<%= j render "form" %>") +$(".new_asset_category")[0].reset(); \ No newline at end of file diff --git a/app/views/admin/assets/_asset.html.erb b/app/views/admin/assets/_asset.html.erb index ea71dc6c0..99ac636e9 100644 --- a/app/views/admin/assets/_asset.html.erb +++ b/app/views/admin/assets/_asset.html.erb @@ -1,17 +1,16 @@ - - <%= asset.id %> -
<%= image_tag(asset.data.url) %>
- <%#= link_to asset.filename, asset.data.url, :target => '_blank' %> + + <%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %> + +
<%= image_tag(asset.data.url) %>
+
+ +
<%= asset.description %> <%= asset.data.file.content_type %> <%= asset.data_identifier %> <%= number_to_human_size(asset.data.file.file_length) %> - - <%= link_to t(:edit), edit_admin_asset_path(asset), :remote => true, :class => 'edit' %> - <%= link_to t(:delete), admin_asset_path(asset), :confirm => t('sure?'), :method => :delete, :remote => true, :class => 'delete' %> - - - - \ No newline at end of file diff --git a/app/views/admin/assets/_edit.html.erb b/app/views/admin/assets/_edit.html.erb index a747d4f24..a62524c03 100644 --- a/app/views/admin/assets/_edit.html.erb +++ b/app/views/admin/assets/_edit.html.erb @@ -9,7 +9,7 @@ <%= link_back %> <%= f.submit t(:edit) %> <% else %> - <%= t(:edit) %> + <%= t(:update) %> <% end %> <% end %> diff --git a/app/views/admin/assets/_filter.html.erb b/app/views/admin/assets/_filter.html.erb new file mode 100644 index 000000000..02ba839b1 --- /dev/null +++ b/app/views/admin/assets/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb index 72199ceb4..6abb883ef 100644 --- a/app/views/admin/assets/_form.html.erb +++ b/app/views/admin/assets/_form.html.erb @@ -8,6 +8,11 @@ <%= f.text_field :description, :class => 'text' %>

+

+<%= f.label :category %> +<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> +

+

<%= f.label :data, t('admin.data'), :class => 'file' %> <%= f.file_field :data %> diff --git a/app/views/admin/assets/_sort_headers.html.erb b/app/views/admin/assets/_sort_headers.html.erb new file mode 100644 index 000000000..2c8ca2343 --- /dev/null +++ b/app/views/admin/assets/_sort_headers.html.erb @@ -0,0 +1,5 @@ +<%= render_sort_bar(true, ['title', 'title','span1-2', 'admin.title'], + ['description', 'description', 'span1-2', 'admin.description'], + ['intro', 'intro', 'span1-2', 'admin.intro'], + ['intro', 'intro', 'span1-2', 'admin.intro'], + ['intro', 'intro', 'span1-2', 'admin.file_length']).html_safe %> diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb index c31db0c7a..7424eb6cc 100644 --- a/app/views/admin/assets/index.html.erb +++ b/app/views/admin/assets/index.html.erb @@ -1,32 +1,31 @@ -<% content_for :secondary do %> -

- -
-<% end -%> - -
-

<%= t('admin.list_assets') %>

- - +<%= form_for :assets, :url => delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> + <%= render 'filter' %> +
- - + + + + + + + + - + <%= render :partial => 'asset', :collection => @assets %> - +
<%= t('admin.id') %> - <%= t('admin.file_name') %> - <%= t('admin.description') %> - <%= t('admin.format') %> - <%= t('admin.orig_upload_file') %> - <%= t('admin.file_size') %> - <%= t('admin.action') %> -
-
\ No newline at end of file +<% end %> + +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %> +
+ <%= paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> +
+
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> + <%= javascript_include_tag "inc/modal-preview" %> +<% end %> + diff --git a/config/environments/development.rb b/config/environments/development.rb index 026247726..2dac58e9a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -24,6 +24,9 @@ Orbit::Application.configure do config.action_dispatch.best_standards_support = :builtin + config.assets.debug = true + + # config.middleware.use ExceptionNotifier, # :email_prefix => "[R4_error]", # :sender_address => %{"notifier" }, diff --git a/config/routes.rb b/config/routes.rb index d2294c17c..248623614 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,12 @@ Orbit::Application.routes.draw do # routes for admin namespace :admin do mount Resque::Server.new, :at => "/resque" - resources :assets + resources :assets do + collection do + post 'delete' + end + end + resources :asset_categories resources :app_auths resources :object_auths do match 'new_interface/:ob_type/:title/new' => "object_auths_new_interface#new" ,:as => :init_ob_auth,:via => :get diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 4e3368b24..4ffea341e 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -50,13 +50,13 @@
- <%= f.date_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'input-small'} %> + <%= f.datetime_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
- <%= f.date_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %> + <%= f.datetime_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
From 30137b50b41b67195dedb1cc316f9fb73defc5a7 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 16 May 2012 15:33:54 +0800 Subject: [PATCH 2/8] popup fix.. --- app/assets/javascripts/ajax_form.js | 11 ++- app/assets/javascripts/new_admin.js | 2 +- app/assets/javascripts/tiny_mce_popup.js | 5 ++ app/assets/javascripts/tinymce_orbit.js.erb | 93 +++++++++++++++++++++ app/controllers/admin/assets_controller.rb | 2 +- app/views/admin/assets/new.html.erb | 2 +- 6 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 app/assets/javascripts/tiny_mce_popup.js create mode 100644 app/assets/javascripts/tinymce_orbit.js.erb diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js index d9b5abfec..b683f43d8 100644 --- a/app/assets/javascripts/ajax_form.js +++ b/app/assets/javascripts/ajax_form.js @@ -4,4 +4,13 @@ $(document).on('click', '#ajax_form_submit', function(){ o.dataType = 'script'; } }); -}); \ No newline at end of file +}); +$(document).ready(function(){ + var win = parent.OWindow; + var thatwindow = win.thiswindow; + alert(self.id); + $("div.button_bar input[type=submit]").click(function(){ + thatwindow.document.getElementById(win.input).value = "Soemthing"; + return false; + }) +}) diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 70bc22bd6..f5fed3685 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -16,4 +16,4 @@ //= require orbit-bar-search //= require side_bar_history //= require rss -//= require ajax_form \ No newline at end of file +//= require ajax_form diff --git a/app/assets/javascripts/tiny_mce_popup.js b/app/assets/javascripts/tiny_mce_popup.js new file mode 100644 index 000000000..f859d24e6 --- /dev/null +++ b/app/assets/javascripts/tiny_mce_popup.js @@ -0,0 +1,5 @@ + +// Uncomment and change this document.domain value if you are loading the script cross subdomains +// document.domain = 'moxiecode.com'; + +var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write(' +<% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/edit.js.erb b/app/views/admin/page_parts/edit.js.erb index 5dd8351c7..3e50360c6 100644 --- a/app/views/admin/page_parts/edit.js.erb +++ b/app/views/admin/page_parts/edit.js.erb @@ -1 +1,44 @@ -$('#back_main').html("<%= j render(:partial => 'edit') %>"); \ No newline at end of file +$('#back_main').html("<%= j render(:partial => 'edit') %>"); +tinymce.init({ + // General options + mode: 'textareas', + theme: 'advanced', + file_browser_callback : 'myFileBrowser', + plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", + + // Theme options + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", + theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor", + theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_statusbar_location : "bottom", + theme_advanced_resizing : true, + + // Skin options + skin : "o2k7", + skin_variant : "silver", + + // Drop lists for link/image/media/template dialogs + template_external_list_url : "js/template_list.js", + // external_link_list_url : "js/link_list.js", + // external_image_list_url : "js/image_list.js", + // media_external_list_url : "js/media_list.js" + + // Style formats + style_formats : [ + {title : 'Bold text', inline : 'b'}, + {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, + {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, + {title : 'Example 1', inline : 'span', classes : 'example1'}, + {title : 'Example 2', inline : 'span', classes : 'example2'}, + {title : 'Table styles'}, + {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} + ], + + // Replace values for the template plugin + template_replace_values : { + username : "Some User", + staffid : "991234" + } +}); \ No newline at end of file From be7ce0bf45a1e18a618fdbc05ddee6f7e055db5f Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 17 May 2012 06:25:38 +0800 Subject: [PATCH 7/8] Redmine change's --- .../panel/announcement/back_end/bulletins/_form.html.erb | 4 ++-- .../views/panel/news/front_end/news_bulletins/show.html.erb | 2 +- .../panel/page_content/front_end/page_contexts/index.html.erb | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 4ffea341e..052472510 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -50,13 +50,13 @@
- <%= f.datetime_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'input-small'} %> + <%= f.datetime_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'span1'} %>
- <%= f.datetime_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %> + <%= f.datetime_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'span1'} %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb index 8959c6aeb..e1c07e3bf 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb @@ -2,10 +2,10 @@

<%= @news_bulletin.title[I18n.locale] %>

+ <%= dislpay_view_count(@news_bulletin) %> <%= @news_bulletin.postdate %>  |  <%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %> - <%= dislpay_view_count(@news_bulletin) %>
diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/front_end/page_contexts/index.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/front_end/page_contexts/index.html.erb index a27a56e77..474ace53e 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/front_end/page_contexts/index.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/front_end/page_contexts/index.html.erb @@ -3,8 +3,9 @@

<%= flash_messages %>

+
<%= dislpay_view_count(@page_context) %>

<%= @page_context.page.i18n_variable[I18n.locale] rescue nil %>

<%= @page_context.context[I18n.locale].html_safe rescue nil %>
-
<%= dislpay_view_count(@page_context) %>
+ From 26292f0dcca8d87fcf3d8e44fe51c7b6e93415fd Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 17 May 2012 06:28:29 +0800 Subject: [PATCH 8/8] Asset upload --- app/assets/javascripts/tinymce_orbit.js.erb | 2 +- app/controllers/admin/assets_controller.rb | 41 +++++++++++-- app/models/asset.rb | 7 +++ app/views/admin/assets/_asset.html.erb | 21 ++++++- app/views/admin/assets/_edit.html.erb | 4 +- app/views/admin/assets/_form.html.erb | 57 ++++++++++++------- app/views/admin/assets/_new.html.erb | 4 +- app/views/admin/assets/_sort_headers.html.erb | 11 ++-- app/views/admin/assets/file_upload.html.erb | 56 ++++++++++++++++++ app/views/admin/assets/index.html.erb | 15 ++--- app/views/admin/assets/index.js.erb | 4 ++ app/views/layouts/_side_bar.html.erb | 1 - config/locales/en.yml | 5 ++ config/locales/zh_tw.yml | 5 ++ config/routes.rb | 1 + 15 files changed, 191 insertions(+), 43 deletions(-) create mode 100644 app/views/admin/assets/file_upload.html.erb create mode 100644 app/views/admin/assets/index.js.erb diff --git a/app/assets/javascripts/tinymce_orbit.js.erb b/app/assets/javascripts/tinymce_orbit.js.erb index 1a9d063d2..51f86b6fd 100644 --- a/app/assets/javascripts/tinymce_orbit.js.erb +++ b/app/assets/javascripts/tinymce_orbit.js.erb @@ -46,7 +46,7 @@ function load_tinymce() { function myFileBrowser(field_name, url, type, win) { var cmsURL = window.location.toString(); cmsURL = cmsURL.split("/"); - cmsURL = "<%= Rails.application.routes.url_helpers.new_admin_asset_path %>"; + cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>"; console.log(cmsURL); // script URL - use an absolute path! if (cmsURL.indexOf("?") < 0) { diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb index 89fd41b7f..fb4865a21 100644 --- a/app/controllers/admin/assets_controller.rb +++ b/app/controllers/admin/assets_controller.rb @@ -11,6 +11,7 @@ class Admin::AssetsController < OrbitBackendController def new @asset = Asset.new @asset_categories = AssetCategory.all + @tags = AssetTag.all respond_to do |format| format.html {} format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} } @@ -20,6 +21,7 @@ class Admin::AssetsController < OrbitBackendController def edit @asset = Asset.find(params[:id]) @asset_categories = AssetCategory.all + @tags = AssetTag.all respond_to do |format| format.html {} format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} } @@ -28,15 +30,29 @@ class Admin::AssetsController < OrbitBackendController def create @asset = Asset.new(params[:asset]) - if @asset.save + @asset.filename = @asset.i18n_variable[I18n.locale] rescue nil + if @asset.filename && @asset.save respond_to do |format| - format.html { render :text => @asset.data.url } - format.js {} + format.js { + if params[:uploader] + render 'create' + else + render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} + end + } end else + flash[:error] = t(:create_fail) + @asset_categories = AssetCategory.all + @tags = AssetTag.all respond_to do |format| - format.html { render :action => :new } - format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}} } + format.js { + if params[:uploader] + render 'file_upload' + else + render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}} + end + } end end end @@ -49,6 +65,9 @@ class Admin::AssetsController < OrbitBackendController format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} } end else + flash[:error] = t(:update_fail) + @asset_categories = AssetCategory.all + @tags = AssetTag.all respond_to do |format| format.html { render :action => :edit } format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} } @@ -71,5 +90,17 @@ class Admin::AssetsController < OrbitBackendController end redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) end + + def file_upload + @asset = Asset.new + @asset_categories = AssetCategory.all + @tags = AssetTag.all + render :layout => false + end + + def file_select + @assets = Asset.all + render :layout => false + end end diff --git a/app/models/asset.rb b/app/models/asset.rb index 2bb02dfcc..9819934f0 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -8,9 +8,16 @@ class Asset field :filename field :description + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + validates_presence_of :filename, :data belongs_to :asset_category belongs_to :assetable, polymorphic: true + has_and_belongs_to_many :tags, :class_name => "AssetTag" + + def sorted_tags + tags.order_by(I18n.locale, :asc) + end end diff --git a/app/views/admin/assets/_asset.html.erb b/app/views/admin/assets/_asset.html.erb index 99ac636e9..9eb4e77a1 100644 --- a/app/views/admin/assets/_asset.html.erb +++ b/app/views/admin/assets/_asset.html.erb @@ -1,7 +1,8 @@ <%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %> + <%= asset.i18n_variable[I18n.locale] rescue nil %> -
<%= image_tag(asset.data.url) %>
+
- <%= asset.description %> <%= asset.data.file.content_type %> - <%= asset.data_identifier %> <%= number_to_human_size(asset.data.file.file_length) %> + <%= asset.category.i18n_variable[I18n.locale] rescue nil %> + +
+
+ <% asset.sorted_tags.each do |tag| %> + <%= tag[I18n.locale] %> + <% end %> +
+
+ + + \ No newline at end of file diff --git a/app/views/admin/assets/_edit.html.erb b/app/views/admin/assets/_edit.html.erb index a62524c03..0e592d197 100644 --- a/app/views/admin/assets/_edit.html.erb +++ b/app/views/admin/assets/_edit.html.erb @@ -1,6 +1,8 @@

<%= t('editing_asset') %>

+ <%= flash_messages %> + <%= form_for @asset, :url => admin_asset_path(@asset), :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %> <%= f.error_messages %> <%= render :partial => "form", :locals => { :f => f } %> @@ -9,7 +11,7 @@ <%= link_back %> <%= f.submit t(:edit) %> <% else %> - <%= t(:update) %> + <%= t(:update) %> <% end %>
<% end %> diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb index 6abb883ef..4e1589f47 100644 --- a/app/views/admin/assets/_form.html.erb +++ b/app/views/admin/assets/_form.html.erb @@ -1,19 +1,38 @@ -

-<%= f.label :filename, t('admin.file_name') %> -<%= f.text_field :filename, :class => 'text' %> -

- -

-<%= f.label :description, t('admin.description') %> -<%= f.text_field :description, :class => 'text' %> -

- -

-<%= f.label :category %> -<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> -

- -

-<%= f.label :data, t('admin.data'), :class => 'file' %> -<%= f.file_field :data %> -

\ No newline at end of file +
+ +
+ <%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= content_tag :label do -%> +
+ <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class => "input-large" %> +
+ <% end %> + <% end %> + <% end %> +
+
+
+ +
+ <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %> +
+
+
+ +
+ <% @tags.each do |tag| %> + <%= content_tag :label, :class => "checkbox inline" do -%> + <%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %> + <%= tag[I18n.locale] %> + <% end %> + <% end %> +
+
+
+ +
+ <%= f.file_field :data, :class => 'upload' %> +
+
\ No newline at end of file diff --git a/app/views/admin/assets/_new.html.erb b/app/views/admin/assets/_new.html.erb index 5d770a2e4..d88382785 100644 --- a/app/views/admin/assets/_new.html.erb +++ b/app/views/admin/assets/_new.html.erb @@ -1,11 +1,13 @@

<%= t('admin.new_asset') %>

+ <%= flash_messages %> + <%= form_for :asset, :url => admin_assets_path, :html => {:id => 'ajaxForm', :multipart => true } do |f| %> <%= f.error_messages %> <%= render :partial => "form", :locals => { :f => f } %> <% end %>
diff --git a/app/views/admin/assets/_sort_headers.html.erb b/app/views/admin/assets/_sort_headers.html.erb index 2c8ca2343..86e5f86aa 100644 --- a/app/views/admin/assets/_sort_headers.html.erb +++ b/app/views/admin/assets/_sort_headers.html.erb @@ -1,5 +1,6 @@ -<%= render_sort_bar(true, ['title', 'title','span1-2', 'admin.title'], - ['description', 'description', 'span1-2', 'admin.description'], - ['intro', 'intro', 'span1-2', 'admin.intro'], - ['intro', 'intro', 'span1-2', 'admin.intro'], - ['intro', 'intro', 'span1-2', 'admin.file_length']).html_safe %> +<%= render_sort_bar(true, ['title', 'title','span4', 'admin.title'], + ['description', 'description', 'span1-2', 'admin.data'], + ['intro', 'intro', 'span1-2', 'admin.file_type'], + ['intro', 'intro', 'span1-2', 'admin.file_length'], + ['intro', 'intro', 'span1-2', 'admin.category'], + ['intro', 'intro', 'span1-2', 'admin.tags']).html_safe %> diff --git a/app/views/admin/assets/file_upload.html.erb b/app/views/admin/assets/file_upload.html.erb new file mode 100644 index 000000000..eeed414be --- /dev/null +++ b/app/views/admin/assets/file_upload.html.erb @@ -0,0 +1,56 @@ +<%= javascript_include_tag "new_admin" %> +<%= stylesheet_link_tag "new_admin" %> + +<%= flash_messages %> + +<%= form_for :asset, :url => admin_assets_path(:uploader => true), :html => {:id => 'ajaxForm', :multipart => true } do |f| %> + + + + +<% end %> \ No newline at end of file diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb index 7424eb6cc..394e18e8a 100644 --- a/app/views/admin/assets/index.html.erb +++ b/app/views/admin/assets/index.html.erb @@ -3,12 +3,13 @@ - - - - - - + + + + + + + @@ -20,7 +21,7 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %>
- <%= paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> + <%= paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}, :remote => true %>
diff --git a/app/views/admin/assets/index.js.erb b/app/views/admin/assets/index.js.erb new file mode 100644 index 000000000..e2e87d360 --- /dev/null +++ b/app/views/admin/assets/index.js.erb @@ -0,0 +1,4 @@ +$("#delete_all").attr("action", "<%= delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>"); +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_assets").html("<%= j render :partial => 'asset', :collection => @assets %>"); +$("#asset_pagination").html("<%= j paginate @assets, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 852bfd4c5..c1c168797 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -72,7 +72,6 @@ <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.asset'), admin_assets_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('assets', '/admin/asset_tags', 'asset_categories')) do -%> <%= content_tag :li, link_to(t('admin.all_assets'), admin_assets_path), :class => active_for_action('assets', 'index') %> - <%= content_tag :li, link_to(t('admin.add_new'), new_admin_asset_path), :class => active_for_action('assets', 'new') %> <%= content_tag :li, link_to(t('admin.categories'), admin_asset_categories_path), :class => active_for_action('asset_categories', 'index') %> <%= content_tag :li, link_to(t('admin.tags'), admin_asset_tags_path), :class => active_for_action('/admin/asset_tags', 'index') %> <% end -%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 3e2ffe8e2..908023d03 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -11,6 +11,7 @@ en: back: Back browse: Browse cancel: Cancel + create_fail: Creation failed create: Create delete: Delete desktop: Desktop @@ -41,6 +42,7 @@ en: submit: Submit sure?: Are you sure? update: Update + update_failed: Update failed view: View view_count: View count yes_: "Yes" @@ -117,6 +119,7 @@ en: calendar: Calendar cant_delete_self: You can not delete yourself. cant_revoke_self_admin: You can not revoke your admin role yourself. + category: Category choose_file: Choose a file... class: Class content: Content @@ -146,6 +149,7 @@ en: enabled_for: Enabled for file_name: Filename file_size: File size + file_upload: File upload format: Format home: Home id: ID @@ -231,6 +235,7 @@ en: site_title: Site title super_pages: Super pages structure: Structure + tags: Tags title: Title translation: Translation type: Type diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 9a1a9952f..14625b96e 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -9,6 +9,7 @@ zh_tw: browse: 選擇檔案 cancel: 取消 create: 新增 + create_fail: 創建失敗 delete: 刪除 desktop: 桌面 disable: 禁用 @@ -35,6 +36,7 @@ zh_tw: submit: 送出 sure?: 您肯定嗎? update: 更新 + update: 更新失敗 view: 檢視 view_count: 查看次數 yes_: "Yes" @@ -110,6 +112,7 @@ zh_tw: calendar: 行事曆 cant_delete_self: 您不可以刪除自己。 cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 + category: 類別 choose_file: 請選擇一個文件... class: 階級 content: 內容 @@ -143,6 +146,7 @@ zh_tw: enabled_for: 啟用 file_name: 檔名 file_size: 檔案大小 + file_upload: 文件上載 format: 格式 home: 首頁 id: ID @@ -230,6 +234,7 @@ zh_tw: site_setting: 網站設定 super_pages: 可編頁面 structure: 網站結構 + tags: 標籤 title: 標題 translation: 翻譯 type: 類型 diff --git a/config/routes.rb b/config/routes.rb index 214f58b2d..ef2c46e28 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,6 +15,7 @@ Orbit::Application.routes.draw do mount Resque::Server.new, :at => "/resque" resources :assets do collection do + get 'file_upload' post 'delete' end end