Merge branch 'nccu_0509' of https://github.com/Rulingcom/orbit into nccu_0509
This commit is contained in:
		
						commit
						4013436027
					
				|  | @ -4,7 +4,7 @@ function load_tinymce() { | ||||||
|     // General options |     // General options | ||||||
|     theme: 'advanced', |     theme: 'advanced', | ||||||
|     file_browser_callback : 'myFileBrowser', |     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", |     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 options | ||||||
|     theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", |     theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", | ||||||
|  | @ -42,37 +42,36 @@ function load_tinymce() { | ||||||
|       staffid : "991234" |       staffid : "991234" | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
|   function myFileBrowser (field_name, url, type, win) { | } | ||||||
|  | function myFileBrowser(field_name, url, type, win) { | ||||||
|  |     var cmsURL = window.location.toString(); | ||||||
|  |       cmsURL = cmsURL.split("/"); | ||||||
|  |       cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";  | ||||||
|  |       console.log(cmsURL); | ||||||
|  |       // 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({ | ||||||
|   var cmsURL = window.location.toString(); |         file : cmsURL, | ||||||
|     cmsURL = cmsURL.split("/"); |         title : 'File Browser', | ||||||
|   //  cmsURL = "http://<?php echo   $_SITE['domain'].$_SITE['rel_path']; ?>/modules/modules/filemanager/";  |         width : 850,  // Your dimensions may differ - toy around with them! | ||||||
|      |         height : 455, | ||||||
|     // script URL - use an absolute path! |         resizable : "no", | ||||||
|   if (cmsURL.indexOf("?") < 0) { |         inline : "no",  // This parameter only has an effect if you use the inlinepopups plugin! | ||||||
|       //add the type as the only query parameter |         close_previous : "no" | ||||||
|       cmsURL = cmsURL + "?type=" + type; |     }, { | ||||||
|   } |         window : win, | ||||||
|   else { |         input : field_name, | ||||||
|       //add the type as an additional query parameter |     }); | ||||||
|       // (PHP session ID is now included if there is one at all) |     return false; | ||||||
|       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() { |   function ajaxSave() { | ||||||
|     var ed = tinyMCE.get('content'); |     var ed = tinyMCE.get('content'); | ||||||
|  | @ -83,7 +82,6 @@ function load_tinymce() { | ||||||
|       alert(ed.getContent()); |       alert(ed.getContent()); | ||||||
|     }, 3000); |     }, 3000); | ||||||
|   } |   } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| $(document).ready(function() { | $(document).ready(function() { | ||||||
|   load_tinymce(); |   load_tinymce(); | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  | class Admin::AssetTagsController < Admin::TagsController | ||||||
|  |    | ||||||
|  |   def initialize | ||||||
|  |     super | ||||||
|  |     @app_title = 'asset' | ||||||
|  |   end | ||||||
|  |    | ||||||
|  | end | ||||||
|  | @ -11,6 +11,7 @@ class Admin::AssetsController < OrbitBackendController | ||||||
|   def new |   def new | ||||||
|     @asset = Asset.new |     @asset = Asset.new | ||||||
|     @asset_categories = AssetCategory.all |     @asset_categories = AssetCategory.all | ||||||
|  |     @tags = AssetTag.all | ||||||
|     respond_to do |format| |     respond_to do |format| | ||||||
|       format.html {} |       format.html {} | ||||||
|       format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} } |       format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} } | ||||||
|  | @ -20,6 +21,7 @@ class Admin::AssetsController < OrbitBackendController | ||||||
|   def edit |   def edit | ||||||
|     @asset = Asset.find(params[:id]) |     @asset = Asset.find(params[:id]) | ||||||
|     @asset_categories = AssetCategory.all |     @asset_categories = AssetCategory.all | ||||||
|  |     @tags = AssetTag.all | ||||||
|     respond_to do |format| |     respond_to do |format| | ||||||
|       format.html {} |       format.html {} | ||||||
|       format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} } |       format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} } | ||||||
|  | @ -28,15 +30,29 @@ class Admin::AssetsController < OrbitBackendController | ||||||
|    |    | ||||||
|   def create   |   def create   | ||||||
|     @asset = Asset.new(params[:asset]) |     @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| |       respond_to do |format| | ||||||
|         format.html { redirect_to admin_assets_url } |         format.js { | ||||||
|         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} } |           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 |       end | ||||||
|     else |     else | ||||||
|  |       flash[:error] = t(:create_fail) | ||||||
|  |       @asset_categories = AssetCategory.all | ||||||
|  |       @tags = AssetTag.all | ||||||
|       respond_to do |format| |       respond_to do |format| | ||||||
|         format.html { render :action => :new } |         format.js {  | ||||||
|         format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}} } |           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 |     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} } |         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 |       end | ||||||
|     else |     else | ||||||
|  |       flash[:error] = t(:update_fail) | ||||||
|  |       @asset_categories = AssetCategory.all | ||||||
|  |       @tags = AssetTag.all | ||||||
|       respond_to do |format| |       respond_to do |format| | ||||||
|         format.html { render :action => :edit } |         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}} } |         format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} } | ||||||
|  | @ -72,4 +91,16 @@ class Admin::AssetsController < OrbitBackendController | ||||||
|     redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) |     redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) | ||||||
|   end |   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 | end | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ module Admin::DashboardHelper | ||||||
| 			when 'news_bulletin' | 			when 'news_bulletin' | ||||||
| 				panel_news_front_end_news_bulletin_path(object) | 				panel_news_front_end_news_bulletin_path(object) | ||||||
| 			when'page_context' | 			when'page_context' | ||||||
| 				panel_page_content_front_end_page_context_path(object) | 				"/#{object.page.path}" | ||||||
| 			when'web_link' | 			when'web_link' | ||||||
| 				panel_web_resource_front_end_web_link_path(object) | 				panel_web_resource_front_end_web_link_path(object) | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | @ -200,4 +200,8 @@ module ApplicationHelper | ||||||
|     display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year}) |     display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year}) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def at_least_module_manager | ||||||
|  |     is_manager? || is_admin?  | ||||||
|  |   end | ||||||
|  | 
 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -8,9 +8,16 @@ class Asset | ||||||
|   field :filename |   field :filename | ||||||
|   field :description |   field :description | ||||||
|    |    | ||||||
|  |   has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|  |    | ||||||
|   validates_presence_of :filename, :data |   validates_presence_of :filename, :data | ||||||
| 
 | 
 | ||||||
|   belongs_to :asset_category |   belongs_to :asset_category | ||||||
|   belongs_to :assetable, polymorphic: true |   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 | end | ||||||
|  |  | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | class AssetTag < Tag | ||||||
|  |    | ||||||
|  |   has_and_belongs_to_many :assets | ||||||
|  | 
 | ||||||
|  | end | ||||||
|  | @ -1,7 +1,8 @@ | ||||||
| <tr id="asset_<%= asset.id %>" class="with_action"> | <tr id="asset_<%= asset.id %>" class="with_action"> | ||||||
| 	<td><%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %></td> | 	<td><%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %></td> | ||||||
|  | 	<td><%= asset.i18n_variable[I18n.locale] rescue nil %></td> | ||||||
| 	<td> | 	<td> | ||||||
| 		<div class="assets_pic"><%= image_tag(asset.data.url) %></div> | 		<i class="icons-picture img-peview" rel="popover" data-content="<img src='<%= asset.data.url %>' />" data-original-title="<%= asset.data.filename %>"></i> | ||||||
| 		<div class="quick-edit"> | 		<div class="quick-edit"> | ||||||
| 			<ul class="nav nav-pills hide"> | 			<ul class="nav nav-pills hide"> | ||||||
| 				<li><%= link_to t(:edit), edit_admin_asset_path(asset), :remote => true, :class => 'edit'  %></li> | 				<li><%= link_to t(:edit), edit_admin_asset_path(asset), :remote => true, :class => 'edit'  %></li> | ||||||
|  | @ -9,8 +10,22 @@ | ||||||
| 			</ul> | 			</ul> | ||||||
| 		</div> | 		</div> | ||||||
| 	</td> | 	</td> | ||||||
| 	<td><%= asset.description %></td> |  | ||||||
| 	<td><%= asset.data.file.content_type %></td> | 	<td><%= asset.data.file.content_type %></td> | ||||||
| 	<td><%= asset.data_identifier %></td> |  | ||||||
| 	<td><%= number_to_human_size(asset.data.file.file_length) %></td> | 	<td><%= number_to_human_size(asset.data.file.file_length) %></td> | ||||||
|  | 	<td><%= asset.category.i18n_variable[I18n.locale] rescue nil %></td> | ||||||
|  | 	<td> | ||||||
|  | 		<div class="label-group"> | ||||||
|  | 			<div class="label-td"> | ||||||
|  | 				<% asset.sorted_tags.each do |tag| %> | ||||||
|  | 					<span class="label label-tags"><%= tag[I18n.locale] %></span> | ||||||
|  | 				<% end %> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
|  | 	</td> | ||||||
| </tr> | </tr> | ||||||
|  | 
 | ||||||
|  | <script type="text/javascript"> | ||||||
|  |     $('.img-peview').popover({ | ||||||
|  |             delay: { show: 100, hide: 300 } | ||||||
|  |     }); | ||||||
|  | </script> | ||||||
|  | @ -1,6 +1,8 @@ | ||||||
| <div id='pop_up_content' class="main2"> | <div id='pop_up_content' class="main2"> | ||||||
| 	<h1><%= t('editing_asset') %></h1> | 	<h1><%= t('editing_asset') %></h1> | ||||||
| 
 | 
 | ||||||
|  | 	<%= flash_messages %> | ||||||
|  | 
 | ||||||
| 	<%= form_for @asset, :url => admin_asset_path(@asset), :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %> | 	<%= form_for @asset, :url => admin_asset_path(@asset), :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %> | ||||||
| 	  <%= f.error_messages %> | 	  <%= f.error_messages %> | ||||||
| 	  <%= render :partial => "form", :locals => { :f => f } %> | 	  <%= render :partial => "form", :locals => { :f => f } %> | ||||||
|  | @ -9,7 +11,7 @@ | ||||||
|     		<%= link_back %> |     		<%= link_back %> | ||||||
| 				<%= f.submit t(:edit) %> | 				<%= f.submit t(:edit) %> | ||||||
| 			<% else %> | 			<% else %> | ||||||
| 				<a id='ajax_form_submit'><%= t(:update) %></a> | 				<a id='ajax_form_submit' class="btn btn-primary"><%= t(:update) %></a> | ||||||
| 			<% end %> | 			<% end %> | ||||||
| 	  </div> | 	  </div> | ||||||
| 	<% end %> | 	<% end %> | ||||||
|  |  | ||||||
|  | @ -1,19 +1,38 @@ | ||||||
| <p> | <div class="control-group"> | ||||||
| <%= f.label :filename, t('admin.file_name') %> |     <label for="title" class="control-label"><%= t 'admin.title' %></label> | ||||||
| <%= f.text_field :filename, :class => 'text' %> |     <div class="controls"> | ||||||
| </p> |         <%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %> | ||||||
| 
 |           <% @site_valid_locales.each do |locale| %> | ||||||
| <p> |             <%= content_tag :label do -%> | ||||||
| <%= f.label :description, t('admin.description') %> |                 <div> | ||||||
| <%= f.text_field :description, :class => 'text' %> |                     <%= I18nVariable.from_locale(locale) %> | ||||||
| </p> |                     <%= f.text_field locale, :class => "input-large" %> | ||||||
| 
 |                 </div> | ||||||
| <p> |             <% end %> | ||||||
| <%= f.label :category %> |           <% end %> | ||||||
| <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> |         <% end %> | ||||||
| </p> |     </div> | ||||||
| 
 | </div> | ||||||
| <p> | <div class="control-group"> | ||||||
| <%= f.label :data, t('admin.data'), :class => 'file' %> |     <label class="control-label"><%= f.label :category, t('admin.category') %></label> | ||||||
| <%= f.file_field :data %> |     <div class="controls"> | ||||||
| </p> |         <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %> | ||||||
|  |     </div> | ||||||
|  | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  |     <label class="control-label"><%= t 'admin.tags' %></label> | ||||||
|  |     <div class="controls"> | ||||||
|  |         <% @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 %> | ||||||
|  |     </div> | ||||||
|  | </div> | ||||||
|  | <div class="control-group"> | ||||||
|  |     <label class="control-label"><%= f.label :data, t('admin.data') %></label> | ||||||
|  |     <div class="controls"> | ||||||
|  |         <%= f.file_field :data, :class => 'upload' %> | ||||||
|  |     </div> | ||||||
|  | </div> | ||||||
|  | @ -1,16 +1,13 @@ | ||||||
| <div id='pop_up_content' class="main2"> | <div id='pop_up_content' class="main2"> | ||||||
| 	<h1><%= t('admin.new_asset') %></h1> | 	<h1><%= t('admin.new_asset') %></h1> | ||||||
| 
 | 
 | ||||||
| 	<%= form_for :asset, :url => admin_assets_path, :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %> | 	<%= flash_messages %> | ||||||
|  | 
 | ||||||
|  | 	<%= form_for :asset, :url => admin_assets_path, :html => {:id => 'ajaxForm', :multipart => true } do |f| %> | ||||||
| 	  <%= f.error_messages %> | 	  <%= f.error_messages %> | ||||||
| 	  <%= render :partial => "form", :locals => { :f => f } %> | 	  <%= render :partial => "form", :locals => { :f => f } %> | ||||||
| 	  <div class="button_bar"> | 	  <div class="button_bar"> | ||||||
| 			<% if is_html %> | 				<a id='ajax_form_submit' class="btn btn-primary"><%= t(:create) %></a> | ||||||
|     		<%= link_back %> |  | ||||||
| 				<%= f.submit t(:create) %> |  | ||||||
| 			<% else %> |  | ||||||
| 				<a id='ajax_form_submit' class="new"><%= t(:create) %></a> |  | ||||||
| 			<% end %> |  | ||||||
| 	  </div> | 	  </div> | ||||||
| 	<% end %> | 	<% end %> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| <%= render_sort_bar(true, ['title', 'title','span1-2', 'admin.title'], | <%= render_sort_bar(true, ['title', 'title','span4', 'admin.title'], | ||||||
| 													['description', 'description', 'span1-2', 'admin.description'], | 													['description', 'description', 'span1-2', 'admin.data'], | ||||||
| 													['intro', 'intro', 'span1-2', 'admin.intro'], | 													['intro', 'intro', 'span1-2', 'admin.file_type'], | ||||||
| 													['intro', 'intro', 'span1-2', 'admin.intro'], | 													['intro', 'intro', 'span1-2', 'admin.file_length'], | ||||||
| 													['intro', 'intro', 'span1-2', 'admin.file_length']).html_safe %> | 													['intro', 'intro', 'span1-2', 'admin.category'], | ||||||
|  | 													['intro', 'intro', 'span1-2', 'admin.tags']).html_safe %> | ||||||
|  |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -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| %> | ||||||
|  |     <div class="modal-header"> | ||||||
|  |         <h3><%= t 'admin.file_upload' %></h3> | ||||||
|  |     </div> | ||||||
|  |     <div class="modal-body form-horizontal"> | ||||||
|  |         <div class="control-group"> | ||||||
|  |             <label for="title" class="control-label"><%= t 'admin.title' %></label> | ||||||
|  |             <div class="controls"> | ||||||
|  |                 <%= 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 -%> | ||||||
|  |                         <div> | ||||||
|  |                             <%= I18nVariable.from_locale(locale) %> | ||||||
|  |                             <%= f.text_field locale, :class => "input-large" %> | ||||||
|  |                         </div> | ||||||
|  |                     <% end %> | ||||||
|  |                   <% end %> | ||||||
|  |                 <% end %> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="control-group"> | ||||||
|  |             <label class="control-label"><%= f.label :category, t('admin.category') %></label> | ||||||
|  |             <div class="controls"> | ||||||
|  |                 <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="control-group"> | ||||||
|  |             <label class="control-label"><%= t 'admin.tags' %></label> | ||||||
|  |             <div class="controls"> | ||||||
|  |                 <% @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 %> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |         <div class="control-group"> | ||||||
|  |             <label class="control-label"><%= f.label :data, t('admin.data') %></label> | ||||||
|  |             <div class="controls"> | ||||||
|  |                 <%= f.file_field :data, :class => 'upload' %> | ||||||
|  |             </div> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  |     <div style="position: absolute; width: 100%; bottom: 0;"> | ||||||
|  |         <div class="modal-footer"> | ||||||
|  |             <a id='ajax_form_submit' class="btn btn-primary"><%= t(:create) %></a> | ||||||
|  |         </div> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|  | <% end %> | ||||||
|  | @ -3,12 +3,13 @@ | ||||||
| 	<table id="asset_sort_list" class="table main-list"> | 	<table id="asset_sort_list" class="table main-list"> | ||||||
| 		<thead> | 		<thead> | ||||||
| 			<tr> | 			<tr> | ||||||
| 			    <th class="span1"></th> |         <th class="span1"></th> | ||||||
| 			    <th class="span1-2"></th> |         <th class="span4"></th> | ||||||
| 			    <th class="span1-2"></th> |         <th class="span1-2"></th> | ||||||
| 			    <th class="span1-2"></th> |         <th class="span1-2"></th> | ||||||
| 			    <th class="span1-2"></th> |         <th class="span1-2"></th> | ||||||
| 			    <th class="span1-2"></th> |         <th class="span1-2"></th> | ||||||
|  |         <th class="span1-2"></th> | ||||||
| 			</tr> | 			</tr> | ||||||
| 		</thead> | 		</thead> | ||||||
| 		<tbody id="tbody_assets" class="sort-holder"> | 		<tbody id="tbody_assets" class="sort-holder"> | ||||||
|  | @ -20,7 +21,7 @@ | ||||||
| <div class="form-actions form-fixed pagination-right"> | <div class="form-actions form-fixed pagination-right"> | ||||||
| 	<%= 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' %> | 	<%= 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' %> | ||||||
| 	<div id="asset_pagination" class="paginationFixed"> | 	<div id="asset_pagination" class="paginationFixed"> | ||||||
| 		<%= 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 %> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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} %>"); | ||||||
|  | @ -6,9 +6,3 @@ | ||||||
| 	  </div> | 	  </div> | ||||||
|   <% end %> |   <% end %> | ||||||
| <% end %> | <% end %> | ||||||
| 
 |  | ||||||
| <script> |  | ||||||
| 	$(document).ready(function() { |  | ||||||
| 	  load_tinymce(); |  | ||||||
| 	}); |  | ||||||
| </script> |  | ||||||
|  |  | ||||||
|  | @ -1 +1,44 @@ | ||||||
| $('#back_main').html("<%= j render(:partial => 'edit') %>"); | $('#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" | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | @ -70,3 +70,12 @@ | ||||||
| 		<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "web_resource"}))), :class => active_for_app_auth('web_resource')  if (is_admin? rescue nil) %> | 		<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "web_resource"}))), :class => active_for_app_auth('web_resource')  if (is_admin? rescue nil) %> | ||||||
| 	<% end -%> | 	<% end -%> | ||||||
| <% end -%> | <% end -%> | ||||||
|  | 
 | ||||||
|  | <%= content_tag :li, :class => active_for_controllers('assets', '/admin/asset_tags', 'asset_categories') do -%> | ||||||
|  | 	<%= 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.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 -%> | ||||||
|  | <% end -%> | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ en: | ||||||
|   back: Back |   back: Back | ||||||
|   browse: Browse |   browse: Browse | ||||||
|   cancel: Cancel |   cancel: Cancel | ||||||
|  |   create_fail: Creation failed | ||||||
|   create: Create |   create: Create | ||||||
|   delete: Delete |   delete: Delete | ||||||
|   desktop: Desktop |   desktop: Desktop | ||||||
|  | @ -41,6 +42,7 @@ en: | ||||||
|   submit: Submit |   submit: Submit | ||||||
|   sure?: Are you sure? |   sure?: Are you sure? | ||||||
|   update: Update |   update: Update | ||||||
|  |   update_failed: Update failed | ||||||
|   view: View |   view: View | ||||||
|   view_count: View count |   view_count: View count | ||||||
|   yes_: "Yes" |   yes_: "Yes" | ||||||
|  | @ -119,6 +121,7 @@ en: | ||||||
|     calendar: Calendar |     calendar: Calendar | ||||||
|     cant_delete_self: You can not delete yourself. |     cant_delete_self: You can not delete yourself. | ||||||
|     cant_revoke_self_admin: You can not revoke your admin role yourself. |     cant_revoke_self_admin: You can not revoke your admin role yourself. | ||||||
|  |     category: Category | ||||||
|     choose_file: Choose a file... |     choose_file: Choose a file... | ||||||
|     class: Class |     class: Class | ||||||
|     content: Content |     content: Content | ||||||
|  | @ -148,6 +151,7 @@ en: | ||||||
|     enabled_for: Enabled for |     enabled_for: Enabled for | ||||||
|     file_name: Filename |     file_name: Filename | ||||||
|     file_size: File size |     file_size: File size | ||||||
|  |     file_upload: File upload | ||||||
|     format: Format |     format: Format | ||||||
|     home: Home |     home: Home | ||||||
|     id: ID |     id: ID | ||||||
|  | @ -233,6 +237,7 @@ en: | ||||||
|     site_title: Site title |     site_title: Site title | ||||||
|     super_pages: Super pages |     super_pages: Super pages | ||||||
|     structure: Structure |     structure: Structure | ||||||
|  |     tags: Tags | ||||||
|     title: Title |     title: Title | ||||||
|     translation: Translation |     translation: Translation | ||||||
|     type: Type |     type: Type | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ zh_tw: | ||||||
|   browse: 選擇檔案 |   browse: 選擇檔案 | ||||||
|   cancel: 取消 |   cancel: 取消 | ||||||
|   create: 新增 |   create: 新增 | ||||||
|  |   create_fail: 創建失敗 | ||||||
|   delete: 刪除 |   delete: 刪除 | ||||||
|   desktop: 桌面 |   desktop: 桌面 | ||||||
|   disable: 禁用 |   disable: 禁用 | ||||||
|  | @ -35,6 +36,7 @@ zh_tw: | ||||||
|   submit: 送出 |   submit: 送出 | ||||||
|   sure?: 您肯定嗎? |   sure?: 您肯定嗎? | ||||||
|   update: 更新 |   update: 更新 | ||||||
|  |   update: 更新失敗 | ||||||
|   view: 檢視 |   view: 檢視 | ||||||
|   view_count: 查看次數 |   view_count: 查看次數 | ||||||
|   yes_: "Yes" |   yes_: "Yes" | ||||||
|  | @ -114,6 +116,7 @@ zh_tw: | ||||||
|     calendar: 行事曆 |     calendar: 行事曆 | ||||||
|     cant_delete_self: 您不可以刪除自己。 |     cant_delete_self: 您不可以刪除自己。 | ||||||
|     cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 |     cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 | ||||||
|  |     category: 類別 | ||||||
|     choose_file: 請選擇一個文件... |     choose_file: 請選擇一個文件... | ||||||
|     class: 階級 |     class: 階級 | ||||||
|     content: 內容 |     content: 內容 | ||||||
|  | @ -150,6 +153,7 @@ zh_tw: | ||||||
|     enabled_for: 啟用 |     enabled_for: 啟用 | ||||||
|     file_name: 檔名 |     file_name: 檔名 | ||||||
|     file_size: 檔案大小 |     file_size: 檔案大小 | ||||||
|  |     file_upload: 文件上載 | ||||||
|     format: 格式 |     format: 格式 | ||||||
|     home: 首頁 |     home: 首頁 | ||||||
|     id: ID |     id: ID | ||||||
|  | @ -237,6 +241,7 @@ zh_tw: | ||||||
|     site_setting: 網站設定 |     site_setting: 網站設定 | ||||||
|     super_pages: 可編頁面 |     super_pages: 可編頁面 | ||||||
|     structure: 網站結構 |     structure: 網站結構 | ||||||
|  |     tags: 標籤 | ||||||
|     title: 標題 |     title: 標題 | ||||||
|     translation: 翻譯 |     translation: 翻譯 | ||||||
|     type: 類型 |     type: 類型 | ||||||
|  |  | ||||||
|  | @ -15,10 +15,12 @@ Orbit::Application.routes.draw do | ||||||
|     mount Resque::Server.new, :at => "/resque" |     mount Resque::Server.new, :at => "/resque" | ||||||
|     resources :assets do    |     resources :assets do    | ||||||
|       collection do |       collection do | ||||||
|  |         get 'file_upload' | ||||||
|         post 'delete' |         post 'delete' | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|     resources :asset_categories |     resources :asset_categories | ||||||
|  |     resources :asset_tags | ||||||
|     resources :app_auths  |     resources :app_auths  | ||||||
|     resources :object_auths  do |     resources :object_auths  do | ||||||
|       match 'new_interface/:ob_type/:title/new' => "object_auths_new_interface#new" ,:as => :init_ob_auth,:via => :get |       match 'new_interface/:ob_type/:title/new' => "object_auths_new_interface#new" ,:as => :init_ob_auth,:via => :get | ||||||
|  |  | ||||||
|  | @ -50,13 +50,13 @@ | ||||||
| 				<div class="control-group"> | 				<div class="control-group"> | ||||||
| 					<label class="control-label">Start</label> | 					<label class="control-label">Start</label> | ||||||
| 					<div class="controls"> | 					<div class="controls"> | ||||||
| 						<%= 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'} %> | ||||||
| 					</div> | 					</div> | ||||||
| 				</div> | 				</div> | ||||||
| 				<div class="control-group"> | 				<div class="control-group"> | ||||||
| 					<label class="control-label">End</label> | 					<label class="control-label">End</label> | ||||||
| 					<div class="controls"> | 					<div class="controls"> | ||||||
| 						<%= 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'} %> | ||||||
| 					</div> | 					</div> | ||||||
| 				</div> | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
|  |  | ||||||
|  | @ -2,10 +2,10 @@ | ||||||
| <h1 class="h1"><%= @news_bulletin.title[I18n.locale] %></h1> | <h1 class="h1"><%= @news_bulletin.title[I18n.locale] %></h1> | ||||||
| <div class="info"> | <div class="info"> | ||||||
| 	<div class="info1"> | 	<div class="info1"> | ||||||
|  | 		<span class="pull-right"><%= dislpay_view_count(@news_bulletin) %></span> | ||||||
| 		<span class="date"><%= @news_bulletin.postdate %></span> | 		<span class="date"><%= @news_bulletin.postdate %></span> | ||||||
| 		 |  | 		 |  | ||||||
| 		<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a> | 		<a href="" class="unit"><%= @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue '' %></a> | ||||||
| 		<span><%= dislpay_view_count(@news_bulletin) %></span> |  | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
| <div class="news_image"> | <div class="news_image"> | ||||||
|  |  | ||||||
|  | @ -3,8 +3,9 @@ | ||||||
| 
 | 
 | ||||||
| <p id="notice"><%= flash_messages %></p> | <p id="notice"><%= flash_messages %></p> | ||||||
| 
 | 
 | ||||||
|  | <div class="view_count pull-right"><%= dislpay_view_count(@page_context) %></div> | ||||||
| <h1 class="h1"><%= @page_context.page.i18n_variable[I18n.locale] rescue nil %></h1> | <h1 class="h1"><%= @page_context.page.i18n_variable[I18n.locale] rescue nil %></h1> | ||||||
| 
 | 
 | ||||||
| <div class="page_content"><%= @page_context.context[I18n.locale].html_safe rescue nil %></div> | <div class="page_content"><%= @page_context.context[I18n.locale].html_safe rescue nil %></div> | ||||||
| 
 | 
 | ||||||
| <div><%= dislpay_view_count(@page_context) %></div> | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue