Mercurial > hg > soundsoftware-site
changeset 1096:8b57fd618c84 bibplugin_db_migrations
Merge
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 29 Nov 2012 14:38:12 +0000 |
parents | 6b67deb0674b (current diff) b9a9efe85907 (diff) |
children | 981cea967d17 |
files | vendor/plugins/redmine_tags/app/controllers/tags_controller.rb vendor/plugins/redmine_tags/app/views/tags/index.html.erb |
diffstat | 35 files changed, 541 insertions(+), 301 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/projects_controller.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/controllers/projects_controller.rb Thu Nov 29 14:38:12 2012 +0000 @@ -111,8 +111,7 @@ end # end of code to be removed - - if validate_parent_id && @project.save + if validate_is_public_key && validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin unless User.current.admin? @@ -300,6 +299,19 @@ render_404 end + def validate_is_public_key + # Although is_public isn't mandatory in the project model (it gets + # defaulted), it must be present in params -- it can be true or + # false, but it must be there. This permits us to make forms in + # which the user _has_ to select public or private (rather than + # defaulting it) if we want to + if params.nil? || params[:project].nil? || !params[:project].has_key?(:is_public) + @project.errors.add :is_public, :public_or_private + return false + end + true + end + # Validates parent_id param according to user's permissions # TODO: move it to Project model in a validation that depends on User.current def validate_parent_id
--- a/app/views/activities/_busy.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/activities/_busy.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,6 +1,6 @@ <% events = @events_by_day %> <% if (events.nil?) - activity = Redmine::Activity::Fetcher.new(User.current) + activity = Redmine::Activity::Fetcher.new(User.anonymous) events = activity.events(Date.today - 14, Date.today + 1) end %>
--- a/app/views/activities/_busy_institution.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/activities/_busy_institution.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,7 +1,8 @@ <% events = @events_by_day %> <% if (events.nil?) - activity = Redmine::Activity::Fetcher.new(User.current) - events = activity.events(Date.today - 14, Date.today + 1) + activity = Redmine::Activity::Fetcher.new(User.anonymous) + days = Setting.activity_days_default.to_i + events = activity.events(Date.today - days, Date.today + 1) end %> @@ -24,3 +25,4 @@ <% end %> </ul> <% end %> +
--- a/app/views/projects/_form.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/projects/_form.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -21,9 +21,20 @@ <br /> <em> <%= l(:text_project_homepage_info) %></em> </p> -<p><%= f.check_box :is_public %> +<p> +<%= label(:project, :is_public_1, l(:field_public_or_private) + content_tag("span", " *", :class => "required")) %> +<% + # if the project hasn't been created fully yet, then we don't + # want to set either public or private (make the user decide) + initialised = !@project.id.nil? +%> + <%= f.radio_button :is_public, 1, :checked => (initialised && @project.is_public?) %> + <%= l(:text_project_public_info) %> <br /> - <em> <%= l(:text_project_visibility_info) %></em> + <%= f.radio_button :is_public, 0, :checked => (initialised && !@project.is_public?) %> + <%= l(:text_project_private_info) %> +<br> + <em><%= l(:text_project_visibility_info) %></em> </p> <%= wikitoolbar_for 'project_description' %>
--- a/app/views/projects/_members_box.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/projects/_members_box.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,8 +1,8 @@ <% if @users_by_role.any? %> - <div class="members box"> + <div id="memberbox"><div class="box"> <h3><%=l(:label_member_plural)%></h3> <p><% @users_by_role.keys.sort.each do |role| %> <%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %><br /> <% end %></p> - </div> + </div></div> <% end %>
--- a/app/views/projects/explore.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/projects/explore.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,23 +1,32 @@ +<% content_for :header_tags do %> + <%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> +<% end %> +<% cache(:action => 'explore', :action_suffix => 'tags', :expires_in => 1.hour) do %> <h2><%= l(:label_explore_projects) %></h2> - <div class="tags box"> <h3><%=l(:label_project_tags_all)%></h3> <%= render :partial => 'projects/tagcloud' %> </div> +<% end %> + <div class="splitcontentleft"> + <% cache(:action => 'explore', :action_suffix => 'busy_institutions', :expires_in => 1.hour) do %> <div class="institutions box"> <h3><%=l(:label_institutions_busy)%></h3> <%= render :partial => 'activities/busy_institution' %> </div> + <% end %> <div class="projects box"> <h3><%=l(:label_project_latest)%></h3> <%= render :partial => 'projects/latest' %> </div> </div> <div class="splitcontentright"> + <% cache(:action => 'explore', :action_suffix => 'busy_projects', :expires_in => 1.hour) do %> <div class="projects box"> <h3><%=l(:label_projects_busy)%></h3> <%= render :partial => 'activities/busy' %> </div> + <% end %> </div>
--- a/app/views/projects/new.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/views/projects/new.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -3,6 +3,5 @@ <% labelled_tabular_form_for @project do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> -<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%= javascript_tag "Form.Element.focus('project_name');" %> <% end %>
--- a/config/locales/en.yml Mon Nov 19 18:58:29 2012 +0000 +++ b/config/locales/en.yml Thu Nov 29 14:38:12 2012 +0000 @@ -130,6 +130,7 @@ circular_dependency: "This relation would create a circular dependency" cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" must_accept_terms_and_conditions: "You must accept the Terms and Conditions" + public_or_private: "You must select either public or private" actionview_instancetag_blank_option: Please select @@ -328,6 +329,7 @@ field_root_directory: Root directory field_cvsroot: CVSROOT field_cvs_module: Module + field_public_or_private: "Public or Private?" setting_external_repository: "Select this if the project's main repository is hosted somewhere else" setting_external_repository_url: "The URL of the existing external repository. Must be publicly accessible without a password" @@ -546,7 +548,7 @@ label_home: Home label_home_heading: Welcome! label_my_page: My page - label_my_account: My account + label_my_account: Account label_my_projects: My projects label_my_page_block: My page block label_administration: Administration @@ -891,7 +893,7 @@ button_expand_all: Expand all button_delete: Delete button_create: Create - button_create_and_continue: Create and continue + button_create_and_continue: Create and Add Another button_test: Test button_edit: Edit button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}" @@ -966,7 +968,9 @@ text_caracters_minimum: "Must be at least %{count} characters long." text_length_between: "Length between %{min} and %{max} characters." text_project_name_info: "This will be the name of your project as it appears throughout this site.<br /> You can change it at any time, in the project's settings." - text_project_visibility_info: "If your project is not public, it will be visible only to you and to users that you have added as project members.<br/>You can change this later if you wish." + text_project_public_info: "Public: visible to anybody browsing the site." + text_project_private_info: "Private: visible only to you, and to users you have added as project members." + text_project_visibility_info: "You can change whether your project is public or private later if you wish." text_user_ssamr_description_info: 'Please describe your current research or development interests.<br/>This information will be used at registration to determine that you are a real person – so please be descriptive, or your application may be delayed or rejected.<br/>After registration, the description is publicly visible in your profile and you can edit it at any time.' text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.'
--- a/public/stylesheets/application.css Mon Nov 19 18:58:29 2012 +0000 +++ b/public/stylesheets/application.css Thu Nov 29 14:38:12 2012 +0000 @@ -256,17 +256,17 @@ .highlight.token-3 { background-color: #aaf;} .box{ -padding:6px; -margin-bottom: 10px; -background-color:#f6f6f6; -color:#505050; -line-height:1.5em; -border: 1px solid #e4e4e4; + padding:6px; + margin-bottom: 10px; + background-color:#f6f6f6; + color:#505050; + line-height:1.5em; + border: 1px solid #e4e4e4; } .box h4 { -margin-top: 0; -padding-top: 0; + margin-top: 0; + padding-top: 0; } div.square { @@ -344,6 +344,25 @@ div#members dt .email { color: #777; font-size: 80%; } div#members dd .roles { font-style: italic; } +div#memberbox h3 { + background: url(../images/group.png) no-repeat 0% 50%; + padding-left: 20px; +} +div#memberbox p { + padding-left: 20px; + margin-left: 0; +} + +div.issues ul { + padding-left: 20px; + margin-left: 0; + list-style-type: none; +} +div.issues p { + padding-left: 20px; + margin-left: 0; +} + .projects .latest .title { margin-right: 0.5em; } .tipoftheday .tip { margin-left: 2em; margin-top: 0.5em; }
--- a/public/themes/soundsoftware/stylesheets/application.css Mon Nov 19 18:58:29 2012 +0000 +++ b/public/themes/soundsoftware/stylesheets/application.css Thu Nov 29 14:38:12 2012 +0000 @@ -147,7 +147,9 @@ */ /* h4 { border-bottom: dotted 1px #c0c0c0; } */ -.wiki p { margin-left: 3em; margin-right: 3em; } +.wiki p, .wiki li { margin-left: 30px; margin-right: 3em; } + +.repository-info .wiki p { margin-left: 0 } div.issue { background: #fdfaf0; border: 1px solid #a9b680; border-left: 4px solid #a9b680; }
--- a/public/themes/soundsoftware/stylesheets/fonts-generic.css Mon Nov 19 18:58:29 2012 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-generic.css Thu Nov 29 14:38:12 2012 +0000 @@ -1,4 +1,4 @@ -@import url(fonts.css); +@import url(fonts.css?2); h1, #project-ancestors-title, #top-menu a { font-family: Insider, 'Gill Sans', Tahoma, sans-serif;
--- a/public/themes/soundsoftware/stylesheets/fonts-mac.css Mon Nov 19 18:58:29 2012 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-mac.css Thu Nov 29 14:38:12 2012 +0000 @@ -1,4 +1,4 @@ -@import url(fonts.css); +@import url(fonts.css?2); h1, #project-ancestors-title, #top-menu a { font-family: Insider, "Lucida Grande", sans-serif;
--- a/public/themes/soundsoftware/stylesheets/fonts-ms.css Mon Nov 19 18:58:29 2012 +0000 +++ b/public/themes/soundsoftware/stylesheets/fonts-ms.css Thu Nov 29 14:38:12 2012 +0000 @@ -1,4 +1,4 @@ -@import url(fonts.css); +@import url(fonts.css?2); /* IE likes us to separate out normal & bold into different fonts rather than use the selectors on the same font */
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Thu Nov 29 14:38:12 2012 +0000 @@ -5,7 +5,7 @@ unloadable model_object Publication - before_filter :find_model_object, :except => [:new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ] + before_filter :find_model_object, :except => [:new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ] before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ] def new @@ -16,13 +16,11 @@ @publication.build_bibtex_entry # and at least one author - # @publication.authorships.build.build_author + # @publication.authorships.build.build_author @author_options = [["#{User.current.name} (@#{User.current.mail.partition('@')[2]})", "#{User.current.class.to_s}_#{User.current.id.to_s}"]] - - end - def create + def create @project = Project.find(params[:project_id]) @author_options = [] @@ -30,7 +28,7 @@ @publication = Publication.new(params[:publication]) @publication.projects << @project unless @project.nil? - if @publication.save + if @publication.save @publication.notify_authors_publication_added(@project) flash[:notice] = "Successfully created publication." @@ -58,19 +56,19 @@ # method for creating "pasted" bibtex entries if bibtex_entry - parse_bibtex_list bibtex_entry + parse_bibtex_list bibtex_entry end end def get_bibtex_required_fields unless params[:value].empty? - fields = BibtexEntryType.fields(params[:value]) + fields = BibtexEntryType.fields(params[:value]) end respond_to do |format| format.js { - render(:update) {|page| + render(:update) {|page| if params[:value].empty? page << "hideOnLoad();" else @@ -92,28 +90,29 @@ end end - def edit + def edit find_project_by_project_id unless params[:project_id].nil? @edit_view = true; @publication = Publication.find(params[:id]) @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type - @author_options = [] + @author_options = [] - @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) + @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) end - def update - @publication = Publication.find(params[:id]) - + def update + @publication = Publication.find(params[:id]) @author_options = [] - logger.error { "INSIDE THE UPDATE ACTION IN THE PUBLICATION CONTROLLER" } - if @publication.update_attributes(params[:publication]) flash[:notice] = "Successfully updated Publication." + # expires the previosly cached entries + Rails.cache.delete "publication-#{@publication.id}-ieee" + Rails.cache.delete "publication-#{@publication.id}-bibtex" + if !params[:project_id].nil? redirect_to :action => :show, :id => @publication, :project_id => params[:project_id] else @@ -121,7 +120,7 @@ end else render :action => 'edit' - end + end end @@ -143,7 +142,7 @@ return authors_entry.split(" and ") end - # parses a list of bibtex + # parses a list of bibtex def parse_bibtex_list(bibtex_list) bibliography = BibTeX.parse bibtex_list @@ -156,11 +155,11 @@ create_bibtex_entry d end end - end + end - def create_bibtex_entry(d) + def create_bibtex_entry(d) @publication = Publication.new - @bentry = BibtexEntry.new + @bentry = BibtexEntry.new authors = [] institution = "" email = "" @@ -178,17 +177,17 @@ else @bentry[field] = d[field] end - end + end @publication.bibtex_entry = @bentry @publication.save - # what is this for??? + # what is this for??? # @created_publications << @publication.id # need to save all authors - # and establish the author-publication association - # via the authorships table + # and establish the author-publication association + # via the authorships table authors.each_with_index.map do |authorname, idx| author = Author.new(:name => authorname) if author.save! @@ -220,12 +219,12 @@ def autocomplete_for_project @publication = Publication.find(params[:id]) - @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects + @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results" render :layout => false end - def autocomplete_for_author + def autocomplete_for_author @results = [] object_id = params[:object_id] @@ -239,8 +238,8 @@ @results = users_list - # TODO: can be optimized… - authorships_list.each do |authorship| + # TODO: can be optimized… + authorships_list.each do |authorship| flag = true users_list.each do |user| @@ -254,7 +253,7 @@ @results << authorship if flag end - render :layout => false + render :layout => false end def get_user_info @@ -272,7 +271,7 @@ respond_to do |format| format.js { - render(:update) {|page| + render(:update) {|page| page[name_field].value = item.name page[email_field].value = item.mail page[institution_field].value = item.institution @@ -294,16 +293,16 @@ end def add_project - @projects = Project.find(params[:publication][:project_ids]) + @projects = Project.find(params[:publication][:project_ids]) @publication.projects << @projects - @project = Project.find(params[:project_id]) + @project = Project.find(params[:project_id]) - # TODO luisf should also respond to HTML??? + # TODO luisf should also respond to HTML??? respond_to do |format| format.html { redirect_to :back } - format.js { - render(:update) {|page| - page[:add_project_form].reset + format.js { + render(:update) {|page| + page[:add_project_form].reset page.replace_html :list_projects, :partial => 'list_projects' } } @@ -320,14 +319,14 @@ @publication.projects.delete proj if request.post? end else - logger.error { "Cannot remove project from publication list" } + logger.error { "Cannot remove project from publication list" } end logger.error { "CURRENT project name#{proj.name} and wanna delete #{@project.name}" } - render(:update) {|page| + render(:update) {|page| page.replace_html "list_projects", :partial => 'list_projects', :id => @publication - } + } end def destroy
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Thu Nov 29 14:38:12 2012 +0000 @@ -12,20 +12,20 @@ def projects_check_box_tags(name, projects) s = '' projects.sort.each do |project| - if User.current.allowed_to?(:edit_publication, project) + if User.current.allowed_to?(:edit_publication, project) s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n" s << '<br />' end end - s + s end - + def choose_author_link(object_name, items) # called by autocomplete_for_author (publications' action/view) # creates the select list based on the results array # results is an array with both Users and Authorships objects - + @author_options = [] @results.each do |result| email_bit = result.mail.partition('@')[2] @@ -34,26 +34,26 @@ end @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"] end - + if @results.size > 0 s = select_tag( form_tag_name(object_name, :author_search_results), options_for_select(@author_options), { :id => form_tag_id(object_name, :author_search_results), :size => 3} ) s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q') else s = "<em>No Authors found that match your search… sorry!</em>" - end + end end def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') end - + def link_to_add_author_fields(name, f, association, action) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) - end + end link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" }) - end + end def sanitized_object_name(object_name) object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") @@ -62,75 +62,77 @@ def sanitized_method_name(method_name) method_name.sub(/\?$/, "") end - + def form_tag_name(object_name, method_name) str = "#{object_name.to_s}[#{sanitized_method_name(method_name.to_s)}]" - str.to_sym + str.to_sym end - - def form_tag_id(object_name, method_name) + + def form_tag_id(object_name, method_name) str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}" str.to_sym end - + def form_object_id(object_name) str = object_name.split("\[").last().gsub("\]","") str.to_sym end - def render_authorships_list(publication) + def render_authorships_list(publication) s = '<p>' - + publication.authorships.each do |authorship| s << link_to_authorship(authorship) s << "<br /><em>#{authorship.institution}</em></p>" - end + end - s + s end - - def render_projects_list(publication, show_delete_icon) + + def render_projects_list(publication, show_delete_icon) s= "" - + publication.projects.visible.each do |proj| s << link_to_project(proj, {}, :class => 'publication_project') - - if show_delete_icon + + if show_delete_icon if User.current.allowed_to?(:edit_publication, @project) if @project == proj # todo: move this message to yml file confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' else confirm_msg = false - end - - s << link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj, :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del') + end + + s << link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj, :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del') end end - - s << "<br />" - end - s + s << "<br />" + end + + s end - - def show_cite_proc_entry(publication) - # code that should be moved either to the model or to the controller? - - publication.print_entry(:ieee) + + def print_ieee_format(publication) + Rails.cache.fetch("publication-#{publication.id}-ieee") do + publication.print_entry(:ieee) + end end - - def print_bibtex_entry(publication) - publication.print_entry(:bibtex) + + def print_bibtex_format(publication) + Rails.cache.fetch("publication-#{publication.id}-bibtex") do + publication.print_entry(:bibtex) + end end - - + + def show_bibtex_fields(bibtex_entry) s = "" bibtex_entry.attributes.keys.sort.each do |key| value = bibtex_entry.attributes[key].to_s next if key == 'id' or key == 'publication_id' or value == "" - s << "<h4>" + l("field_#{key}") + "</h4>" + s << "<h4>" + l("field_#{key}") + "</h4>" s << "<p>" if key == "entry_type" s << bibtex_entry.entry_type_label @@ -140,6 +142,6 @@ s << "</p>" end s - end + end end
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Thu Nov 29 14:38:12 2012 +0000 @@ -2,10 +2,10 @@ class Publication < ActiveRecord::Base unloadable - + has_many :authorships, :dependent => :destroy, :order => "auth_order ASC" has_many :authors, :through => :authorships, :uniq => true - + has_one :bibtex_entry, :dependent => :destroy validates_presence_of :title @@ -14,11 +14,30 @@ accepts_nested_attributes_for :authorships accepts_nested_attributes_for :authors, :allow_destroy => true accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true - + has_and_belongs_to_many :projects, :uniq => true - + before_save :set_initial_author_order + named_scope :visible, lambda {|*args| { :include => :projects, + :conditions => Project.allowed_to_condition(args.shift || User.current, :view_publication, *args) } } + + acts_as_activity_provider :type => 'publication', + :timestamp => "#{Publication.table_name}.created_at", + :find_options => { + :include => :projects, + :conditions => "#{Project.table_name}.id = projects_publications.project_id" + } + + acts_as_event :title => Proc.new {|o| o.title }, + :datetime => :created_at, + :type => 'publications', + :author => nil, + #todo - need too move the cache from the helper to the model + :description => Proc.new {|o| o.print_entry(:ieee)}, + :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }} + + # Ensure error message uses proper text instead of # bibtex_entry.entry_type (#268). There has to be a better way to # do this! @@ -30,62 +49,62 @@ end end - def notify_authors_publication_added(project) + def notify_authors_publication_added(project) self.authors.each do |author| Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } Mailer.deliver_publication_added(author.user, self, project) unless author.user.nil? end end - - def notify_authors_publication_updated(project) + + def notify_authors_publication_updated(project) self.authors.each do |author| Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } Mailer.deliver_publication_updated(author.user, self, project) unless author.user.nil? end end - - + + def set_initial_author_order authorships = self.authorships - + logger.debug { "Publication \"#{self.title}\" has #{authorships.size} authors." } - + authorships.each_with_index do |authorship, index| if authorship.auth_order.nil? authorship.auth_order = index end - end + end end - + def print_bibtex_author_names - # this authors are correctly sorted because the authorships model + # this authors are correctly sorted because the authorships model # already outputs the author names ASC by auth_order self.authorships.map{|a| a.name_on_paper}.join(' and ') - end - + end + def print_entry(style) bib = BibTeX::Entry.new bib.author = self.print_bibtex_author_names bib.title = self.title - self.bibtex_entry.attributes.keys.sort.each do |key| + self.bibtex_entry.attributes.keys.sort.each do |key| value = self.bibtex_entry.attributes[key].to_s next if key == 'id' or key == 'publication_id' or value == "" - if key == "entry_type" + if key == "entry_type" bib.type = BibtexEntryType.find(self.bibtex_entry.entry_type).name else bib[key.to_sym] = value - end + end end - + if style == :ieee - CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html - else + CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html + else bibtex = bib.to_s :include => :meta_content bibtex.strip! logger.error { bibtex } - end + end end end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/activities/_recent.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -0,0 +1,92 @@ +<% events = @events_by_day %> +<% max = 5 %> +<% if (events.nil?) + activity = Redmine::Activity::Fetcher.new(User.current, :project => @project) + + if @project + # Don't show news (duplicated with News box) or wiki edits (too + # tedious) in project front page + activity.scope = [ "changesets", "files", "issues", "documents" ] + end + + events = activity.events(Date.today - 28, Date.today + 1) + + if defined? user + events = events.select { |e| + + if e.class != Publication + user.member_of? e.project + else + e.projects.map {|p| user.member_of? p } + end + } + + end + + events = events.first(max) + + end +%> + +<div id="activity"> + +<% if @project.nil? %> + <%= content_tag('h3', l(:label_activity_my_recent)) %> + <div class="activity box"> +<% end %> + +<% if events.empty? %> + + <% if @project.nil? %> + <p><%= l(:label_activity_my_recent_none) %></p> + <% end %> + +<% else %> + + <% if !@project.nil? %> + <div class="activity box"> + <%= content_tag('h3', l(:label_activity_recent)) %> + <% end %> + + <dl> + <% events.sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> + <%- if e.class != Publication -%> + <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> + <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <span class="time"><%= format_time(e.event_datetime) %></span> + <%= content_tag('span', link_to_project(e.project), :class => 'project') if @project.nil? || @project != e.project %> + <% if e.respond_to?(:event_author) %> + <span class="author"><%= e.event_author %></span> + <% end %> + </dt> + <dd><%= link_to format_activity_title(e.event_title), e.event_url %> + <span class="description"><%= format_activity_description(e.event_description) %></span> + </dd> + <% else -%> + <dt class="<%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> + <span class="time"><%= format_time(e.event_datetime) %></span> + <%= link_to format_activity_title(e.event_title), e.event_url %> + was added to the following + <% if e.projects.count > 1 %> + projects: + <%- else -%> + project: + <%- end -%> + <%= content_tag('span', e.projects.join(', ')) -%> <% if e.respond_to?(:event_author) %> + <span class="author"><%= e.event_author %></span> + <% end %> + </dt> + <dd><%= link_to format_activity_title(e.event_title), e.event_url %> + <span class="description"><%= format_activity_description(e.event_description) %></span> + </dd> + <% end -%> + <% end -%> + </dl> + + </div> + +<% end %> + +<% if events.empty? and @project.nil? %></div><% end %> + +</div>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/activities/index.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -0,0 +1,91 @@ +<h2><%= + if @author.nil? + if @institution_name.blank? + l(:label_activity) + else + l(:label_institution_activity, h(@institution_name)) + end + else + l(:label_user_activity, link_to_user(@author)) + end + %></h2> +<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p> + +<div id="activity"> +<% @events_by_day.keys.sort.reverse.each do |day| %> +<h3><%= format_activity_day(day) %></h3> +<dl> +<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> + <%- if e.class != Publication -%> + <dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> + <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <span class="time"><%= format_time(e.event_datetime, false) %></span> + <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> + <%= link_to format_activity_title(e.event_title), e.event_url %> + </dt> + <dd> + <span class="description"><%= format_activity_description(e.event_description) %></span> + <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span> + </dd> + <%- else -%> + <dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"> + <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %> + <span class="time"><%= format_time(e.event_datetime, false) %></span> + <%= link_to format_activity_title(e.event_title), e.event_url %> + was added to the following + <% if e.projects.count > 1 %> + projects: + <%- else -%> + project: + <%- end -%> + <%= content_tag('span', e.projects.join(', ')) -%> + </dt> + <dd> + <span class="description"><%= e.event_description -%></span> + <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span> + </dd> + <% end -%> +<%- end -%> +</dl> +<% end -%> +</div> + +<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %> + +<div style="float:left;"> +<%= link_to_content_update("\xc2\xab " + l(:label_previous), + params.merge(:from => @date_to - @days - 1), + :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %> +</div> +<div style="float:right;"> +<%= link_to_content_update(l(:label_next) + " \xc2\xbb", + params.merge(:from => @date_to + @days - 1), + :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %> +</div> + +<% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %> +<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> +<% end %> + +<% content_for :sidebar do %> +<% form_tag({}, :method => :get) do %> +<h3><%= l(:label_activity) %></h3> +<p><% @activity.event_types.each do |t| %> +<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> +<label for="show_<%=t%>"><%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id]})%></label> +<br /> +<% end %></p> +<% if @project && @project.descendants.active.any? %> + <%= hidden_field_tag 'with_subprojects', 0 %> + <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> +<% end %> +<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> +<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> +<% end %> +<% end %> + +<% html_title(l(:label_activity), @author) -%>
--- a/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -9,18 +9,18 @@ <div class="box"> <h3><%=l(:label_related_publication_plural)%></h3> - <dl> - <% @project.publications.each do |publication| %> + <dl> + <% @project.publications.each do |publication| %> <dt> - <%= publication.print_entry(:ieee) -%> + <%= print_ieee_format(publication) %> </dt> <dd> - <%= link_to("[More Details]", {:controller => :publications, :action => :show, :id => publication.id, :project_id => @project.id}) -%> - - <%= link_to_function "[Bibtex]", onclick="toggleBibtex(this)" -%> + <%= link_to("[More Details]", {:controller => :publications, :action => :show, :id => publication.id, :project_id => @project.id}) -%> + + <%= link_to_function "[B<small>IB</small>T<sub>E</sub>X]", onclick="toggleBibtex(this)" -%> </dd> <dd class="bibtex-textarea collapsed" style="display: none;"> - <textarea readonly><%= publication.print_entry(:bibtex) -%></textarea> + <textarea readonly> <%= print_bibtex_format(publication) %> </textarea> </dd> <% end -%> </dl>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,8 +1,8 @@ -<%= f.error_messages %> +<%= f.error_messages %> <h3><%= f.text_field :title, :required => true, :size => 70 %></h3> -<div class="splitcontentleft"> +<div class="splitcontentleft"> <h3><%= l(:label_publication_other_details) %></h3> <div class="box tabular"> <% f.fields_for :bibtex_entry do |builder| -%> @@ -14,12 +14,17 @@ <br /> <em><%= l(:text_external_url) %></em> </p> + <p> + <%= f.text_field :doi, :size => 70 %> + <br /> + <em><%= l(:text_doi) %></em> + </p> </div> </div> <div class="splitcontentright"> - <h3><%= l(:authors) %></h3> + <h3><%= l(:authors) %></h3> <div class="box tabular"> <% f.fields_for :authorships do |builder| -%> <%= render "authorship_fields", :f => builder %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -2,10 +2,10 @@ <div class="box"> <h3>Publication Info</h3> - <%= show_cite_proc_entry(@publication)%> - - <h3>Bibtex Format</h3> - <%=h print_bibtex_entry(@publication) %> + <p><%= print_ieee_format(@publication)%></p> + + <h3>B<small>IB</small>T<sub>E</sub>X Format</h3> + <pre><%=h print_bibtex_format(@publication) %></pre> </div> <div class="box"> @@ -14,7 +14,7 @@ <ul id="authorships"> <% for authorship in @publication.authorships.find(:all, :order => :auth_order) %> <% content_tag_for :li, authorship do %> - <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> + <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%> <span class="handle">[drag to reorder]</span> <%- end -%> <%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br /> @@ -30,17 +30,21 @@ <%= show_bibtex_fields(@publication.bibtex_entry) %> <%- end -%> -<% unless @publication.external_url.blank? %> - <h4> - <%= l(:field_external_url) %> - </h4> +<%- unless @publication.external_url.blank? -%> <p> - <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} %> + <b><%= l(:field_external_url) %>:</b> <%= link_to h(@publication.external_url), @publication.external_url, {:target => "_blank"} -%> + </p> +<%- end -%> + + +<% unless @publication.doi.blank? %> + <p> + <b><%= l(:field_doi)-%>:</b> <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%> </p> <% end %> <br / > - <% if User.current.allowed_to?(:add_publication, @project) %> + <% if User.current.allowed_to?(:add_publication, @project) %> <%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> | <%= link_to "Delete", {:controller => 'publications', :action => 'destroy', :id => @publication, :project_id => @project }, :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %> | @@ -49,15 +53,15 @@ </div> <% projects = Project.active.find(:all, :limit => 100, :order => 'name ASC') - @publication.projects %> - + <% content_for :sidebar do %> <h3><%=l(:label_publication_project_index)%></h3> <p id="list_projects"> <%= render :partial => 'list_projects' %> </p> - + <%- if User.current.allowed_to?(:edit_publication, @project) -%> - <%= render :partial => 'add_project_form' %> + <%= render :partial => 'add_project_form' %> <%- end -%> <% end %>
--- a/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/stylesheets/bibliography.css Thu Nov 29 14:38:12 2012 +0000 @@ -33,18 +33,20 @@ } -div#bibliography dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; } +div#bibliography dd { margin-bottom: 1em; font-size: 0.9em; } div#bibliography dd .authors { font-style: italic; } div#bibliography dd span.authors { color: #808080; } div#bibliography dd span.year { padding-left: 0.6em; } div#bibliography .box dt { - background: url(../../../images/document.png) no-repeat 0% 50%; padding-left: 20px; - margin-left: 2em; + background: url(../../../images/document.png) no-repeat 0% 4px; + padding-left: 20px; + margin-left: 0; } div#bibliography .box dd { - margin-left: 25px; + padding-left: 20px; + margin-left: 0; } div#bibliography h3 { @@ -58,4 +60,4 @@ font: normal 8px; padding: 2px 10px; border: solid 1px #ddd; -} \ No newline at end of file +}
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Thu Nov 29 14:38:12 2012 +0000 @@ -12,8 +12,7 @@ label_my_publications_box: "My Publications" view_all_publications: "View All Project's Publications" publications: Publications - - + identify_author_question: Is the right person selected above? identify_author_yes: "Yes" identify_author_correct: "Yes, but I need to correct some details below" @@ -25,24 +24,25 @@ label_all_publications_for_project: Publications associated with %{project} label_authors_show: "Authorships associated with this author" label_authors_index: "List of authors" - + field_authorship_publication_title: "Publication" field_authorship_name: "Name on Paper" field_authorship_email: "Email" field_authorship_institution: "Institution" - + field_external_url: "External URL" + field_doi: "DOI" field_publication_title: Title field_publication_authors: Authors field_publication_projects: "Associated projects" field_author_name: Author field_author_user: User Name field_author_username: "Associated user" - field_author_publications: "Publications by this Author" + field_author_publications: "Publications by this Author" field_identify_author_yes: "Yes" field_identify_author_correct: "Corrections" field_identify_author_no: "No" - + label_author_is_me: "(I am this author)" label_add_me_as_author: "Add me as an author" label_add_an_author: "Add an author" @@ -54,7 +54,7 @@ label_author_information: "Author Information" remove_author: "Remove this author" - + label_publication_plural: "Publications" label_related_publication_plural: "Related publications" label_publication_new: "Create New Publication" @@ -67,22 +67,23 @@ label_publication_project_index: "Projects associated with this publication" label_publication_index: "View all publications" label_publication_other_details: "Details" - + text_external_url: "Link to the publication or to an external page about it." + text_doi: "DOI (Digital Object Identifier)." text_author_name_on_paper: "Author's name as it appears on the paper." text_author_institution: "Author's institution as on the paper." text_author_email: "Author's email address as on the paper." - + text_author_search: "Search existing authors" - + # authorships model field_institution: "Institution" - field_name_on_paper: "Name" + field_name_on_paper: "Name" field_email: "Email Address" - + # bibtex_entries model field_entry_type: "Publication Type" - field_id: "id" + field_id: "id" field_publication_id: "Publication_id" field_address: "Address" field_annote: "Annote" @@ -122,7 +123,7 @@ field_bibtex_proceedings: Conference proceedings field_bibtex_techreport: Technical report field_bibtex_unpublished: Unpublished - + label_author_1: First author label_author_2: Second author label_author_3: Third author @@ -146,6 +147,6 @@ mail_subject_publication_added: "You have been added as an author to a new publication" mail_body_publication_added: "A new publication (%{publication}) has been added to the project '%{project}.'" - - - + + +
--- a/vendor/plugins/redmine_bibliography/init.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/init.rb Thu Nov 29 14:38:12 2012 +0000 @@ -4,9 +4,6 @@ require 'bibtex' require 'citeproc' - -RAILS_DEFAULT_LOGGER.info 'Starting Bibliography Plugin for RedMine' - # Patches to the Redmine core. Dispatcher.to_prepare :redmine_model_dependencies do require_dependency 'project' @@ -25,7 +22,9 @@ Mailer.send(:include, Bibliography::MailerPatch) end - + unless ProjectsHelper.included_modules.include?(Bibliography::ProjectsHelperPatch) + ProjectsHelper.send(:include, Bibliography::ProjectsHelperPatch) + end end @@ -41,15 +40,22 @@ settings :default => { 'menu' => 'Publications' }, :partial => 'settings/bibliography' project_module :redmine_bibliography do + permission :view_publication, {:publications => :show}, :public => :true permission :publications, { :publications => :index }, :public => true permission :edit_publication, {:publications => [:edit, :update]} permission :add_publication, {:publications => [:new, :create]} permission :delete_publication, {:publications => :destroy} + end # extending the Project Menu menu :project_menu, :publications, { :controller => 'publications', :action => 'index', :path => nil }, :after => :activity, :param => :project_id, :caption => Proc.new { Setting.plugin_redmine_bibliography['menu'] }, :if => Proc.new { !Setting.plugin_redmine_bibliography['menu'].blank? } - + + activity_provider :publication, :class_name => 'Publication', :default => true + end + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/projects_helper_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -0,0 +1,17 @@ +module Bibliography + module ProjectsHelperPatch + + def self.included(base) # :nodoc: + base.send(:include, InstanceMethods) + base.send(:include, PublicationsHelper) + + base.class_eval do + unloadable + end + end + + module InstanceMethods + end + end +end +
--- a/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -1,16 +1,16 @@ require_dependency 'user' module Bibliography - module UserAuthorPatch + module UserAuthorPatch def self.included(base) - base.send(:include, InstanceMethods) - extend ClassMethods - + base.send(:include, InstanceMethods) + extend ClassMethods + end #self.included - + module ClassMethods - end - + end + module InstanceMethods def institution @@ -18,28 +18,28 @@ institution_name = self.ssamr_user_detail.institution_name else institution_name = "No Institution Set" - end - return institution_name + end + return institution_name end def get_author_info # TODO: DELETE THIS METHOD?? - info = { + info = { :name_on_paper => self.name, :email => self.mail, :institution => "", :author_user_id => self.id, - :is_user => "1" + :is_user => "1" } if not self.ssamr_user_detail.nil? info[:institution] = self.ssamr_user_detail.institution_name end - return info + return info end - + end #InstanceMethods - + end #UserPublicationsPatch end #RedmineBibliography
--- a/vendor/plugins/redmine_tags/app/controllers/tags_controller.rb Mon Nov 19 18:58:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -class TagsController < ApplicationController - - def index - respond_to do |format| - format.html { - render :template => 'tags/index.html.erb', :layout => !request.xhr? - } - format.api { - } - format.atom { - } - end - end - -end
--- a/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -6,7 +6,7 @@ </p> <div id="project_tag_candidates" class="autocomplete"></div> <%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' -%> - <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}', true)" -%> + <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags')}', true)" -%> </div> <%- end -%> </p>
--- a/vendor/plugins/redmine_tags/app/views/projects/_filter_tags.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_tags.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -7,7 +7,7 @@ <div id="project_tag_candidates" class="autocomplete"></div> <%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> - <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => Project.first.id)}')" %> + <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}')" %> </div> <% end -%> </p>
--- a/vendor/plugins/redmine_tags/app/views/projects/_tagcloud.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_tagcloud.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -1,6 +1,3 @@ -<% content_for :header_tags do %> - <%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> -<% end %> <div id="tags"> <%= render_tags_list(Project.available_tags, :style => :cloud) %>
--- a/vendor/plugins/redmine_tags/app/views/projects/_tags_form.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/app/views/projects/_tags_form.html.erb Thu Nov 29 14:38:12 2012 +0000 @@ -6,6 +6,6 @@ </p> <div id="project_tag_candidates" class="autocomplete"></div> <%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> - <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => Project.first.id)}', false)" %> + <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}', false)" %> </div> <% end -%> \ No newline at end of file
--- a/vendor/plugins/redmine_tags/app/views/tags/index.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> - <%= stylesheet_link_tag 'redmine_tags', :plugin => 'redmine_tags' %> -<% end %> - - -<div style="clear:both;"></div> -<h2> - <%= l("label_project_tags_all") %> -</h2> - -<%= render_tags_list(Project.available_tags, :style => :cloud) %> -
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -13,38 +13,12 @@ unloadable attr_accessor :tag_list - acts_as_taggable end end - def before_save_with_save_tags() -# debugger - logger.error { "GONNA SAVE TAG LIST" } - - -# params[:tag_list] - - - # logger.error { @project.name } - - # if params && params[:project] && !params[:project][:tag_list].nil? - # old_tags = context[:project].tag_list.to_s - # context[:project].tag_list = params[:project][:tag_list] - # new_tags = context[:project].tag_list.to_s - # - # unless (old_tags == new_tags || context[:project].current_journal.blank?) - # context[:project].current_journal.details << JournalDetail.new(:property => 'attr', - # :prop_key => 'tag_list', - # :old_value => old_tags, - # :value => new_tags) - # end - # end - end - module InstanceMethods - end module ClassMethods @@ -64,7 +38,7 @@ name_like = options[:name_like] options = {} visible = ARCondition.new - + visible << ["#{Project.table_name}.is_public = '1'"] if name_like @@ -73,7 +47,7 @@ options[:conditions] = visible.conditions - self.all_tag_counts(options) + self.all_tag_counts(options) end end end
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -3,11 +3,11 @@ module RedmineTags module Patches - module ProjectsControllerPatch + module ProjectsControllerPatch def self.included(base) base.send(:include, InstanceMethods) - base.class_eval do - unloadable + base.class_eval do + unloadable skip_before_filter :authorize, :only => [:set_fieldset_status] skip_before_filter :find_project, :only => [:set_fieldset_status] before_filter :add_tags_to_project, :only => [:save, :update] @@ -17,7 +17,7 @@ end module InstanceMethods - + def add_tags_to_project if params && params[:project] && !params[:project][:tag_list].nil? @@ -57,17 +57,17 @@ else @myproj_status = session[:my_projects_fieldset_status] end - + if session[:filters_fieldset_status].nil? @filter_status = "false" else @filter_status = session[:filters_fieldset_status] end - + if params && params[:project] && !params[:project][:tag_list].nil? @filter_status = "true" end - + end # Lists visible projects. Paginator is for top-level projects only @@ -78,17 +78,17 @@ get_fieldset_statuses respond_to do |format| - format.html { + format.html { paginate_projects - - @projects = Project.visible_roots.find(@projects, :offset => @offset, :limit => @limit, :order => sort_clause) + + @projects = Project.visible_roots.find(@projects, :offset => @offset, :limit => @limit, :order => sort_clause) if User.current.logged? # seems sort_by gives us case-sensitive ordering, which we don't want # @user_projects = User.current.projects.sort_by(&:name) @user_projects = User.current.projects.all(:order => :name) end - + render :template => 'projects/index.html.erb', :layout => !request.xhr? } format.api { @@ -112,8 +112,8 @@ private - def filter_projects - @question = (params[:q] || "").strip + def filter_projects + @question = (params[:q] || "").strip if params.has_key?(:project) @tag_list = (params[:project][:tag_list] || "").strip.split(",") @@ -126,7 +126,7 @@ else @projects = Project.visible_roots.find(Project.visible.search_by_question(@question)) end - + unless @tag_list.empty? @tagged_projects_ids = Project.visible.tagged_with(@tag_list).collect{ |project| Project.find(project.id).root } @projects = @projects & @tagged_projects_ids
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb Thu Nov 29 14:38:12 2012 +0000 @@ -5,12 +5,13 @@ def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.send(:include, TagsHelper) + base.class_eval do unloadable end end - module InstanceMethods + module InstanceMethods # Renders a tree of projects that the current user does not belong # to, or of all projects if the current user is not logged in. The # given collection may be a subset of the whole project tree @@ -19,30 +20,30 @@ # description, manager(s), creation date, last activity date, # general activity level, whether there is anything actually hosted # here for the project, etc. - def render_project_table_with_filtering(projects, question) + def render_project_table_with_filtering(projects, question) custom_fields = "" s = "" if projects.any? tokens = RedmineProjectFiltering.calculate_tokens(question, custom_fields) - + s << "<div class='autoscroll'>" s << "<table class='list projects'>" s << "<thead><tr>" - + s << sort_header_tag('name', :caption => l("field_name")) s << "<th class='tags'>" << l("tags") << "</th>" s << "<th class='managers'>" << l("label_managers") << "</th>" s << sort_header_tag('created_on', :default_order => 'desc') s << sort_header_tag('updated_on', :default_order => 'desc') - + s << "</tr></thead><tbody>" - + original_project = @project - + projects.each do |project| s << render_project_in_table_with_filtering(project, cycle('odd', 'even'), 0, tokens) end - + s << "</table>" else s << "\n" @@ -52,7 +53,7 @@ s end - def render_project_in_table_with_filtering(project, oddeven, level, tokens) + def render_project_in_table_with_filtering(project, oddeven, level, tokens) # set the project environment to please macros. @project = project @@ -72,7 +73,7 @@ s << "<td class='tags' align=top>" << project.tag_counts.collect{ |t| render_project_tag_link(t) }.join(', ') << "</td>" s << "<td class='managers' align=top>" - + u = project.users_by_role if u u.keys.each do |r| @@ -91,7 +92,7 @@ end s << "</td>" - + s << "<td class='created_on' align=top>" << format_date(project.created_on) << "</td>" s << "<td class='updated_on' align=top>" << format_date(project.updated_on) << "</td>" @@ -105,9 +106,9 @@ s end - - - + + + # Renders a tree of projects as a nested set of unordered lists # The given collection may be a subset of the whole project tree # (eg. some intermediate nodes are private and can not be seen) @@ -116,7 +117,7 @@ if projects.any? tokens = RedmineProjectFiltering.calculate_tokens(question, custom_fields) debugger - + ancestors = [] original_project = @project @@ -128,14 +129,14 @@ else ancestors.pop s << "</li>" - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop s << "</ul></li>" end end classes = (ancestors.empty? ? 'root' : 'child') s << "<li class='#{classes}'><div class='#{classes}'>" + - link_to( highlight_tokens(project.name, tokens), + link_to( highlight_tokens(project.name, tokens), {:controller => 'projects', :action => 'show', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}" ) @@ -146,7 +147,7 @@ # value = value_model.present? ? value_model.value : nil # s << "<li><b>#{field.name.humanize}:</b> #{highlight_tokens(value, tokens)}</li>" if value.present? # end - + s << "</ul>" s << "<div class='clear'></div>" unless project.description.blank? @@ -163,7 +164,7 @@ end s.join "\n" end - + # Renders a tree of projects where the current user belongs # as a nested set of unordered lists # The given collection may be a subset of the whole project tree @@ -193,9 +194,9 @@ s end - - - + + + def render_my_project_in_hierarchy_with_tags(project) @@ -215,7 +216,7 @@ else s << " <span class='private'>" << l(:field_is_private) << "</span>" end - + tc = project.tag_counts if tc.empty? s << " <span class='no-tags'>" << l(:field_no_tags) << "</span>" @@ -242,15 +243,15 @@ end - - + + private - + # copied from search_helper. This one doesn't escape html or limit the text length def highlight_tokens(text, tokens) return text unless text && tokens && !tokens.empty? re_tokens = tokens.collect {|t| Regexp.escape(t)} - regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE + regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE result = '' text.split(regexp).each_with_index do |words, i| words = words.mb_chars @@ -263,7 +264,7 @@ end result end - + end end end