##// END OF EJS Templates
Unlimited and optional project description. The project list will show truncated descriptions only (the first fews lines)....
Jean-Philippe Lang -
r1074:df99d8f30801
parent child
Show More
@@ -0,0 +1,8
1 class ChangeProjectsDescriptionToText < ActiveRecord::Migration
2 def self.up
3 change_column :projects, :description, :text, :default => ''
4 end
5
6 def self.down
7 end
8 end
@@ -52,12 +52,11 class Project < ActiveRecord::Base
52 52
53 53 attr_protected :status, :enabled_module_names
54 54
55 validates_presence_of :name, :description, :identifier
55 validates_presence_of :name, :identifier
56 56 validates_uniqueness_of :name, :identifier
57 57 validates_associated :custom_values, :on => :update
58 58 validates_associated :repository, :wiki
59 59 validates_length_of :name, :maximum => 30
60 validates_length_of :description, :maximum => 255
61 60 validates_length_of :homepage, :maximum => 60
62 61 validates_length_of :identifier, :in => 3..20
63 62 validates_format_of :identifier, :with => /^[a-z0-9\-]*$/
@@ -184,6 +183,15 class Project < ActiveRecord::Base
184 183 name.downcase <=> project.name.downcase
185 184 end
186 185
186 def to_s
187 name
188 end
189
190 # Returns a short description of the projects (first lines)
191 def short_description(length = 255)
192 description.gsub(/^(.{#{length}}[^\n]*).*$/m, '\1').strip if description
193 end
194
187 195 def allows_to?(action)
188 196 if action.is_a? Hash
189 197 allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
@@ -27,7 +27,7
27 27 <% for project in @projects %>
28 28 <tr class="<%= cycle("odd", "even") %>">
29 29 <td><%= project.active? ? link_to(h(project.name), :controller => 'projects', :action => 'settings', :id => project) : h(project.name) %>
30 <td><%= textilizable project.description, :project => project %>
30 <td><%= textilizable project.short_description, :project => project %>
31 31 <td align="center"><%= image_tag 'true.png' if project.is_public? %>
32 32 <td align="center"><%= project.children.size %>
33 33 <td align="center"><%= format_date(project.created_on) %>
@@ -8,8 +8,11
8 8 <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
9 9 <% end %>
10 10
11 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 5 %><em><%= l(:text_caracters_maximum, 255) %></em></p>
12 <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %><br /><em><%= l(:text_length_between, 3, 20) %> <%= l(:text_project_identifier_info) unless @project.identifier_frozen? %></em></p>
11 <p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
12 <p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen? %>
13 <% unless @project.identifier_frozen? %>
14 <br /><em><%= l(:text_length_between, 3, 20) %> <%= l(:text_project_identifier_info) %></em>
15 <% end %></p>
13 16 <p><%= f.text_field :homepage, :size => 40 %></p>
14 17 <p><%= f.check_box :is_public %></p>
15 18 <%= wikitoolbar_for 'project_description' %>
@@ -2,7 +2,7
2 2
3 3 <% @project_tree.keys.sort.each do |project| %>
4 4 <h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
5 <%= textilizable(project.description, :project => project) %>
5 <%= textilizable(project.short_description, :project => project) %>
6 6
7 7 <% if @project_tree[project].any? %>
8 8 <p><%= l(:label_subproject_plural) %>:
@@ -18,7 +18,7
18 18 <% for project in @projects %>
19 19 <li>
20 20 <%= link_to project.name, :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>)
21 <%= textilizable project.description, :project => project %>
21 <%= textilizable project.short_description, :project => project %>
22 22 </li>
23 23 <% end %>
24 24 </ul>
General Comments 0
You need to be logged in to leave comments. Login now