* finished Issue 58: Add description to root of DMSF

git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@113 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
vit.jonas@gmail.com 2011-06-01 06:59:58 +00:00
parent db76d6c436
commit bdd3a064d6
7 changed files with 74 additions and 5 deletions

View File

@ -21,7 +21,7 @@ class DmsfController < ApplicationController
before_filter :find_project before_filter :find_project
before_filter :authorize, :except => [:delete_entries] before_filter :authorize, :except => [:delete_entries]
before_filter :find_folder, :except => [:new, :create] before_filter :find_folder, :except => [:new, :create, :edit_root, :save_root]
before_filter :find_parent, :only => [:new, :create] before_filter :find_parent, :only => [:new, :create]
helper :sort helper :sort
@ -218,6 +218,16 @@ class DmsfController < ApplicationController
render_403 render_403
end end
def edit_root
end
def save_root
@project.dmsf_description = params[:project][:dmsf_description]
@project.save!
flash[:notice] = l(:notice_folder_details_were_saved)
redirect_to :controller => "dmsf", :action => "show", :id => @project
end
def notify_activate def notify_activate
if @folder.notification if @folder.notification
flash[:warning] = l(:warning_folder_notifications_already_activated) flash[:warning] = l(:warning_folder_notifications_already_activated)

View File

@ -4,7 +4,7 @@
</div> </div>
<% create = @pathfolder == @parent %> <% create = @pathfolder == @parent %>
<h2> <h2>
<%= render(:partial => "/dmsf/path", :locals => {:path => @pathfolder.nil? ? [] : @pathfolder.dmsf_path}) %> <%= render(:partial => "path", :locals => {:path => @pathfolder.nil? ? [] : @pathfolder.dmsf_path}) %>
<%= ("/ " + l(:heading_new_folder)) if create %> <%= ("/ " + l(:heading_new_folder)) if create %>
</h2> </h2>

View File

@ -0,0 +1,25 @@
<% html_title(l(:dmsf)) %>
<div class="contextual">
</div>
<h2><%= render(:partial => "path", :locals => {:path => []}) %></h2>
<% form_for(:project, @project, :url => {:action => "save_root", :id => @project},
:html => {:method=>:post}) do |f| %>
<div class="box dmsf_detail">
<p class="no-ident">
<%= label_tag("project_dmsf_description", l(:label_description) + ":") %>
</p>
<div class="wiki data clear">
<%= f.text_area(:dmsf_description, :rows => 15, :class => "wiki-edit") %>
</div>
</div>
<%= submit_tag(l(:submit_save)) %>
<% end %>
<%= wikitoolbar_for "dmsf_folder_description" %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
<% end %>

View File

@ -2,7 +2,11 @@
<div class="contextual"> <div class="contextual">
<% if User.current.allowed_to?(:folder_manipulation, @project) %> <% if User.current.allowed_to?(:folder_manipulation, @project) %>
<% unless @folder.nil? %> <% if @folder.nil? %>
<%= link_to(image_tag("edit.png", :style => "vertical-align: text-top;"),
{:action => "edit_root", :id => @project},
:title => l(:link_edit, :title => l(:link_documents))) %> &nbsp;
<% else @folder.nil? %>
<%= link_to(image_tag("edit.png", :style => "vertical-align: text-top;"), <%= link_to(image_tag("edit.png", :style => "vertical-align: text-top;"),
{:action => "edit", :id => @project, :folder_id => @folder }, {:action => "edit", :id => @project, :folder_id => @folder },
:title => l(:link_edit, :title => h(@folder.title))) %> &nbsp; :title => l(:link_edit, :title => h(@folder.title))) %> &nbsp;
@ -19,7 +23,7 @@
</h2> </h2>
<div class="wiki"> <div class="wiki">
<%= textilizable(@folder.description) unless @folder.nil? %> <%= textilizable(@folder.nil? ? @project.dmsf_description : @folder.description) %>
</div> </div>
<% <%

View File

@ -29,6 +29,8 @@ class DmsfNormalization < ActiveRecord::Migration
end end
def self.down def self.down
drop_table :dmsf_file_revision_audit
rename_column :dmsf_folders, :title, :name
end end
end end

View File

@ -0,0 +1,28 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Dmsf080 < ActiveRecord::Migration
def self.up
add_column :projects, :dmsf_description, :text
end
def self.down
remove_column :projects, :dmsf_description
end
end

View File

@ -55,7 +55,7 @@ Redmine::Plugin.register :redmine_dmsf do
permission :user_preferences, {:dmsf_state => [:user_pref_save]} permission :user_preferences, {:dmsf_state => [:user_pref_save]}
permission :view_dmsf_files, {:dmsf => [:entries_operation, :entries_email], permission :view_dmsf_files, {:dmsf => [:entries_operation, :entries_email],
:dmsf_files => [:show]} :dmsf_files => [:show]}
permission :folder_manipulation, {:dmsf => [:new, :create, :delete, :edit, :save]} permission :folder_manipulation, {:dmsf => [:new, :create, :delete, :edit, :save, :edit_root, :save_root]}
permission :file_manipulation, {:dmsf_files => [:create_revision, :delete, :lock, :unlock], permission :file_manipulation, {:dmsf_files => [:create_revision, :delete, :lock, :unlock],
:dmsf_upload => [:upload_files, :upload_file, :commit_files]} :dmsf_upload => [:upload_files, :upload_file, :commit_files]}
permission :file_approval, {:dmsf_files => [:delete_revision, :notify_activate, :notify_deactivate], permission :file_approval, {:dmsf_files => [:delete_revision, :notify_activate, :notify_deactivate],