form_for replaced with labelled_form_for

This commit is contained in:
Karel Picman 2016-03-09 17:54:48 +01:00
parent 417e80bbcf
commit 6ed40654d6
15 changed files with 104 additions and 105 deletions

View File

@ -350,10 +350,15 @@ class DmsfController < ApplicationController
end
def save_root
if params[:project]
@project.dmsf_description = params[:project][:dmsf_description]
@project.save!
if @project.save
flash[:notice] = l(:notice_folder_details_were_saved)
redirect_to :controller => 'dmsf', :action => 'show', :id => @project
else
flash[:error] = @project.errors.full_messages.to_sentence
end
end
redirect_to dmsf_folder_path(:id => @project)
end
def notify_activate

View File

@ -206,8 +206,8 @@ class DmsfWorkflowsController < ApplicationController
# Reload
if params[:dmsf_workflow] && params[:dmsf_workflow][:name].present?
@dmsf_workflow.name = params[:dmsf_workflow][:name]
elsif params[:dmsf_workflow_id].present?
wf = DmsfWorkflow.find_by_id params[:dmsf_workflow_id]
elsif params[:dmsf_workflow] && params[:dmsf_workflow][:id].present?
wf = DmsfWorkflow.find_by_id params[:dmsf_workflow][:id]
@dmsf_workflow.name = wf.name if wf
end
@ -216,8 +216,8 @@ class DmsfWorkflowsController < ApplicationController
def create
if params[:dmsf_workflow]
if (params[:dmsf_workflow_id].to_i > 0)
wf = DmsfWorkflow.find_by_id params[:dmsf_workflow_id]
if (params[:dmsf_workflow][:id].to_i > 0)
wf = DmsfWorkflow.find_by_id params[:dmsf_workflow][:id]
@dmsf_workflow = wf.copy_to(@project, params[:dmsf_workflow][:name]) if wf
else
@dmsf_workflow = DmsfWorkflow.new

View File

@ -68,23 +68,21 @@
<%= render(:partial => 'path',
:locals => {:folder => @pathfolder, :filename => create ? l(:heading_new_folder) : nil, :title => nil}) %>
<%= form_for(@folder, :url => {:action => create ? 'create' : 'save', :id => @project, :folder_id => @folder, :parent_id => @parent},
<%= labelled_form_for(@folder, :url => {:action => create ? 'create' : 'save', :id => @project, :folder_id => @folder, :parent_id => @parent},
:html => {:method=>:post}) do |f| %>
<%= error_messages_for(@folder) %>
<div class="box tabular">
<p>
<label for="dmsf_folder_title"><%= l(:label_title) %><span class="required">*</span></label>
<%= f.text_field(:title, :size => '32', :required => true) %>
<%= f.text_field(:title, :required => true) %>
</p>
<p>
<%= label_tag('', l(:field_folder)) %>
<%= f.select(:dmsf_folder_id,
options_for_select(DmsfFolder.directory_tree(@project, @folder),
:selected => @parent? @parent.id : (@pathfolder.id if @pathfolder)))
:selected => @parent? @parent.id : (@pathfolder.id if @pathfolder)),
:label => l(:field_folder))
%>
</p>
<p>
<%= label_tag('dmsf_folder_description', l(:label_description)) %>
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %>
</p>
<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>

View File

@ -43,15 +43,15 @@
<%= render(:partial => 'path',
:locals => {:folder => nil, :filename => nil, :title => nil}) %>
<%= form_for(@project, :url => {:action => 'save_root', :id => @project},
<%= labelled_form_for(@project, :url => {:action => 'save_root', :id => @project},
:html => {:method => :post}) do |f| %>
<div class="box tabular">
<p>
<%= label_tag('project_dmsf_description', l(:label_description)) %>
<%= f.text_area(:dmsf_description, :rows => 8, :class => 'wiki-edit') %>
<%= f.text_area(:dmsf_description, :rows => 8, :class => 'wiki-edit',
:label => l(:field_description)) %>
</p>
</div>
<%= submit_tag(l(:submit_save)) %>
<%= f.submit l(:submit_save) %>
<% end %>
<%= wikitoolbar_for 'project_dmsf_description' %>

View File

@ -28,24 +28,21 @@
<% if @file.locked_for_user? %>
<p class="warning"><%= l(:info_file_locked) %></p>
<% else %>
<%= form_for(@revision, :url => { :action => 'create_revision', :id => @file },
<%= labelled_form_for(@revision, :url => { :action => 'create_revision', :id => @file },
:html => { :method => :post, :multipart => true, :id => 'new_revision_form' }) do |f| %>
<div class="clear">
<div class="splitcontentleft">
<p>
<%= label_tag('dmsf_file_revision_title', l(:label_title)) %>
<%= f.text_field(:title, :size => 32) %>
<%= f.text_field(:title) %>
</p>
</div>
<div class="splitcontentright">
<p>
<%= label_tag('', l(:label_file)) %>
<%= f.text_field(:name, :size => 22) %>
<%= f.text_field(:name, :label => l(:label_file)) %>
</p>
</div>
</div>
<p>
<%= label_tag('dmsf_file_revision_description', l(:label_description)) %>
<%= f.text_area(:description, :rows => 6, :class => 'wiki-edit') %>
</p>
<div class="clear">
@ -94,10 +91,9 @@
<% end %>
</div>
<p>
<%= label_tag('dmsf_file_revision_comment', l(:label_comment)) %>
<%= f.text_area(:comment, :rows => 2) %>
<%= f.text_area(:comment, :rows => 2, :label => l(:label_comment)) %>
</p>
<%= submit_tag(l(:submit_create)) %>
<%= f.submit l(:submit_create) %>
<% end %>
<% end %>
</div>

View File

@ -17,7 +17,8 @@
#
# 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.%>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% html_title l(:dmsf) %>
@ -79,13 +80,13 @@
</div>
<div id="link_external" style="<%= @link_external ? '' : 'display:none' %>">
<p>
<label for="dmsf_link[external_url]"><%= l(:label_link_external_url) %><span class="required">*</span></label>
<%= text_field_tag 'dmsf_link[external_url]', @dmsf_link.external_url, :size => 40, :maxlength => 255 %>
<%= f.text_field :external_url,
:maxlength => 255, :required => true, :label => l(:label_link_external_url) %>
</p>
</div>
<p>
<label for="dmsf_link[name]"><%= l(:label_link_name) %><span class="required">*</span></label>
<%= text_field_tag 'dmsf_link[name]', @dmsf_link.name, :size => 40, :maxlength => 255 %>
<%= f.text_field :name,
:maxlength => 255, :required => true, :label => l(:label_link_name) %>
</p>
</div>
<p><%= f.submit l(:button_create) %></p>

View File

@ -1,10 +1,11 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License

View File

@ -1,8 +1,11 @@
<%# Redmine plugin for Document Management System "Features"
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License

View File

@ -19,21 +19,23 @@
#
# 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.%>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% html_title(l(:dmsf)) %>
<% html_title l(:dmsf) %>
<%= render(:partial => '/dmsf/path', :locals => {:folder => @folder, :filename => nil}) %>
<%= render(:partial => '/dmsf/path',
:locals => {:folder => @folder, :filename => nil, :title => l(:heading_uploaded_files)}) %>
<% if (@folder && @folder.description.present?) || @project.description.present? %>
<div class="wiki">
<%= textilizable(@folder.description) if @folder %>
<%= textilizable(@folder ? @folder.description : @project.description) %>
</div>
<% end %>
<h3><%=l(:heading_uploaded_files)%></h3>
<% i = 1 %>
<%= form_tag({:action => 'commit_files', :id => @project, :folder_id => @folder},
:method => :post) do %>
<% @uploads.each do |upload| %>
<% @uploads.each_with_index do |upload, i| %>
<% if upload.locked %>
<%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %>
<% else %>
@ -41,5 +43,5 @@
<% end %>
<% i += 1 %>
<% end %>
<%= submit_tag(l(:submit_commit)) %>
<%= submit_tag l(:submit_commit) %>
<% end %>

View File

@ -1,8 +1,9 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License

View File

@ -1,8 +1,9 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -21,11 +22,11 @@
<h3 class="title"><%= l(:dmsf_new_step) %></h3>
<%= form_for(:dmsf_workflow, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %>
<%= labelled_form_for(@dmsf_workflow, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %>
<%= render :partial => 'new_step_form' %>
<p class="buttons">
<%= submit_tag l(:dmsf_and), :id => 'add-step-and' %>
<%= submit_tag l(:dmsf_or), :id => 'add-step-or' %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
<%= f.submit l(:dmsf_and), :id => 'add-step-and' %>
<%= f.submit l(:dmsf_or), :id => 'add-step-or' %>
<%= f.submit l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
</p>
<% end %>

View File

@ -1,8 +1,9 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -28,7 +29,10 @@
<%= labelled_form_for @dmsf_workflow do |f| %>
<%= error_messages_for 'workflow' %>
<div class="box tabular">
<p><%= f.text_field :name, :value => @dmsf_workflow.name, :required => true %><%= submit_tag l(:button_save) %></p>
<p>
<%= f.text_field :name, :required => true %>
<%= f.submit l(:button_save) %>
</p>
</div>
<% end %>

View File

@ -1,6 +1,9 @@
<%# Redmine plugin for Document Management System "Features"
<%
# encoding: utf-8
#
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -14,7 +17,8 @@
#
# 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.%>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% project = Project.find_by_id params[:project_id] if params[:project_id] %>
<% if project %>
@ -24,20 +28,19 @@
<% end %>
<%= labelled_form_for @dmsf_workflow do |f| %>
<%= f.hidden_field(:project_id) if project %>
<%= error_messages_for 'dmsf_workflow' %>
<div class="box tabular">
<p>
<%= f.text_field :name, :value => @dmsf_workflow.name, :size => 25, :maxlength => 255, :required => true %>
<%= f.text_field :name, :required => true %>
</p>
<p>
<%= label_tag :label_copy_workflow_from, l(:label_copy_workflow_from) %>
<%= select_tag('dmsf_workflow_id', dmsf_all_workflows_for_select(params[:dmsf_workflow_id])) %>
<%= f.select(:id,
dmsf_all_workflows_for_select(params[:dmsf_workflow] ? params[:dmsf_workflow][:id] : nil),
:label => l(:label_copy_workflow_from)) %>
</p>
<% if project %>
<p><%= hidden_field_tag :project_id, project.id %></p>
<% end %>
</div>
<%= submit_tag l(:button_create) %>
<%= f.submit l(:button_create) %>
<% end %>
<script type="text/javascript">

View File

@ -1,19 +0,0 @@
<%
# encoding: utf-8
#
# Redmine plugin for Kontron customisation
# Copyright (c) 2011-15 Kontron
# Karel Pičman <karel.picman@kontron.com>
#
# Repository folders
%>
<h2><%= l(:label_repository_folders) %></h2>
<%= form_for(:repository_folder, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %>
<%= render :partial => 'new_step_form' %>
<p>
<%= submit_tag l(:dmsf_and), :id => 'add-step-and' %>
<%= submit_tag l(:dmsf_or), :id => 'add-step-or' %>
</p>
<% end %>

View File

@ -1,6 +1,9 @@
<%# Redmine plugin for Document Management System "Features"
<%
# encoding: utf-8
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License