diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index 17f86060..a427667d 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,13 +1,15 @@ -$('.bulletin_links_block a.delete').live('click', function(){ - $(this).parents('.list_item').remove(); +$('.bulletin_links_block a.remove_existing_record').live('click', function(){ + //$(this).parents('.list_item').remove(); + $(this).parents('tr.list_item').remove(); }); -$('.bulletin_files_block a.delete').live('click', function(){ - $(this).parents('.list_item').remove(); +$('.bulletin_files_block a.remove_existing_record').live('click', function(){ + //$(this).parents('.list_item').remove(); + $(this).parents('tr.list_item').remove(); }); $('.action a.remove_existing_record').live('click', function(){ $(this).next('.should_destroy').attr('value', 1); - $("#bulletin_" + $(this).prev().attr('value')).hide(); + //$("#bulletin_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_" + $(this).prev().attr('value')).hide(); }); \ 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 61e2c4d8..220781a7 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -13,7 +13,7 @@ <% end -%> <%= content_tag :li, :class => active_for_controllers('users') do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), panel_web_resource_back_end_web_links_path %> + <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <% end -%> <%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb new file mode 100644 index 00000000..04a75fa6 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_links_controller.rb @@ -0,0 +1,14 @@ +class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController + + layout 'new_admin' + + def index + @bulletin_links = BulletinLink.all + + respond_to do |format| + format.html # index.html.erb + # format.xml { render :xml => @bulletins } + format.js + end + +end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 09e94c2d..77454b85 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -15,7 +15,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController # @bulletins = Bulletin.search(params[:search], params[:category_id]) # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) - @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all + @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.limit(1).desc("postdate") @bulletin_categories = BulletinCategory.all respond_to do |format| diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb index 6da49ceb..ef2d4bc7 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb @@ -1,36 +1,47 @@ -
" class='list_item'> -
- <%= f.label :file %> - <%#= file_field_tag 'bulletin[file]' %> - <%= f.file_field :file %> - - <%= f.label :file_title %> - <%#= f.text_field :filetitle %> - <%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale %> + " class='list_item'> + +
+
+ <%= f.file_field :file %> +
+
+ + + <%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ +
+ <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
+
+ <% end %> <% end %> - <% end %> - - <%= f.label :file_description %> - <%#= f.text_field :description %> - <%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale %> + + + <%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ +
+ <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
+
+ <% end %> <% end %> - <% end %> - + + <% if bulletin_file.new_record? %> - <%= t(:delete) %> + <% else %> <%= f.hidden_field :id %> - <%= t(:delete) %> + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> -
-
+ + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb index e0077384..c8503083 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb @@ -1,27 +1,37 @@ -
" class='list_item'> -
- - <%= f.label :link_url %> - <%= f.text_field :url %> - - <%= f.label :link_name %> - <%#= f.text_field :name %> - <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> - <% @site_valid_locales.each do |locale| %> - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %> - <%= f.text_field locale, :style => "width:130px" %> - <% end %> - <% end %> - + " class='list_item'> + + +
+
+ <%= f.text_field :url %> +
+
+ + + <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> +
+
+ <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> +
+
+ + + + <% end %> + <% end %> + + + <% if bulletin_link.new_record? %> - <%= t(:delete) %> + <% else %> <%= f.hidden_field :id %> - <%= t(:delete) %> + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> -
-
+ + 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 2e41f302..3cefe360 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 @@ -13,7 +13,8 @@

Picture

- + +
- - - + +
+ +
@@ -202,38 +229,60 @@
- +
-
- - - - -
- -
-

Bulletin files

- <%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %> - <%= t(:add) %> -
- - <%#= render :partial => 'file', :locals => { :bulletin_files => @bulletin.bulletin_files , :f => f} %> - - - <% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %> - <%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %> - <%= f.fields_for :bulletin_files, bulletin_file do |f| %> - <%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> - -
- -
-
+ + + + + +
+
+
+ +
+

File

+
+ + + + + + + + + + + + + + + + +
+ + <% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %> + <%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %> + <%= f.fields_for :bulletin_files, bulletin_file do |f| %> + <%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + +
+ + +
FileName<%= t('description') %>
+
+ <%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %> + ADD/新增 +
+
+
+
+
- + @@ -252,13 +301,13 @@ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_links", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $('#bulletin_links').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id)); }); $('#add_bulletin_file a.add').live('click', function(){ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_bulletin_files", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); - $('#bulletin_files').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); + $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); });