| |   |
| 1 | 1 | class WikisController < ApplicationController |
| 2 | 2 | |
| 3 | 3 | def index |
| 4 | | # Project Wiki index page, shows list of all wikis for that project |
| 5 | 4 | if params[:project_id] != nil |
| 6 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 5 | # Project Wiki index page, shows list of all wikis for that project |
| 6 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 7 | 7 | if @project != nil |
| 8 | | @title = "List Wikis" |
| 9 | | #@url_suffix = Project.tab_settings(PRJ_TAB_DOCUMENTATION) |
| 10 | | @url_suffix = "" |
| 11 | 8 | @wikis = Wiki.find_by_project(@project.id) |
| 12 | | if @wikis.size > 0 |
| 9 | if @wikis.size > 0 |
| 10 | @title = "List Wikis" |
| 11 | @url_suffix = "" |
| 13 | 12 | render :action => "ac_project_index" |
| 14 | 13 | else |
| 15 | 14 | flash[:error] = "No wikis for this project." |
| … | … | |
| 19 | 19 | redirect_to root_path |
| 20 | 20 | end |
| 21 | 21 | else |
| 22 | | # show default wiki page |
| 22 | # Main wiki - default page |
| 23 | 23 | @wiki = Wiki.find_by_slug("wiki-contents") |
| 24 | 24 | @wiki_breadcrumb = false |
| 25 | 25 | @title = "Wiki" |
| … | … | |
| 29 | 29 | |
| 30 | 30 | def show |
| 31 | 31 | if params[:project_id] != nil |
| 32 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 32 | # Project wiki, page specfied |
| 33 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 33 | 34 | if @project != nil |
| 34 | | # Project wiki, page specfied |
| 35 | 35 | @wiki = Wiki.find_by_slug(params[:id]) |
| 36 | 36 | if @wiki != nil |
| 37 | 37 | @title = @wiki.title |
| … | … | |
| 47 | 47 | redirect_to root_path |
| 48 | 48 | end |
| 49 | 49 | else |
| 50 | | # Normal Wiki index page |
| 50 | # Main wiki index page |
| 51 | 51 | @wiki = Wiki.find_by_slug(params[:id]) |
| 52 | 52 | if @wiki != nil |
| 53 | 53 | @wiki_breadcrumb = true |
| … | … | |
| 65 | 65 | |
| 66 | 66 | def new |
| 67 | 67 | if params[:project_id] != nil |
| 68 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 68 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 69 | 69 | if @project != nil |
| 70 | 70 | @wiki = Wiki.new |
| 71 | 71 | @title = "New " + @project.title + " Wiki Page" |
| … | … | |
| 84 | 84 | |
| 85 | 85 | def create |
| 86 | 86 | #FIXME error check @project |
| 87 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 87 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 88 | 88 | @wiki = Wiki.new(params[:wiki]) |
| 89 | 89 | @wiki.slug = to_slug(@wiki.title) |
| 90 | 90 | @wiki.project_id = @project.id |
| … | … | |
| 101 | 101 | |
| 102 | 102 | def edit |
| 103 | 103 | if params[:project_id] != nil |
| 104 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 104 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 105 | 105 | if @project != nil |
| 106 | 106 | # Project wiki, page specfied |
| 107 | 107 | @wiki = Wiki.find_by_slug(params[:id]) |
| … | … | |
| 132 | 132 | |
| 133 | 133 | def update |
| 134 | 134 | if params[:project_id] != nil |
| 135 | | @project = Project.find_by_slug(params[:project_id], current_user) |
| 135 | @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user) |
| 136 | 136 | if @project != nil |
| 137 | 137 | # Project wiki, page specfied |
| 138 | 138 | @wiki = Wiki.find_by_slug(params[:id]) |
| toggle raw diff |
--- a/app/controllers/wikis_controller.rb
+++ b/app/controllers/wikis_controller.rb
@@ -1,15 +1,14 @@
class WikisController < ApplicationController
def index
- # Project Wiki index page, shows list of all wikis for that project
if params[:project_id] != nil
- @project = Project.find_by_slug(params[:project_id], current_user)
+ # Project Wiki index page, shows list of all wikis for that project
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
if @project != nil
- @title = "List Wikis"
- #@url_suffix = Project.tab_settings(PRJ_TAB_DOCUMENTATION)
- @url_suffix = ""
@wikis = Wiki.find_by_project(@project.id)
- if @wikis.size > 0
+ if @wikis.size > 0
+ @title = "List Wikis"
+ @url_suffix = ""
render :action => "ac_project_index"
else
flash[:error] = "No wikis for this project."
@@ -20,7 +19,7 @@ class WikisController < ApplicationController
redirect_to root_path
end
else
- # show default wiki page
+ # Main wiki - default page
@wiki = Wiki.find_by_slug("wiki-contents")
@wiki_breadcrumb = false
@title = "Wiki"
@@ -30,9 +29,9 @@ class WikisController < ApplicationController
def show
if params[:project_id] != nil
- @project = Project.find_by_slug(params[:project_id], current_user)
+ # Project wiki, page specfied
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
if @project != nil
- # Project wiki, page specfied
@wiki = Wiki.find_by_slug(params[:id])
if @wiki != nil
@title = @wiki.title
@@ -48,7 +47,7 @@ class WikisController < ApplicationController
redirect_to root_path
end
else
- # Normal Wiki index page
+ # Main wiki index page
@wiki = Wiki.find_by_slug(params[:id])
if @wiki != nil
@wiki_breadcrumb = true
@@ -66,7 +65,7 @@ class WikisController < ApplicationController
def new
if params[:project_id] != nil
- @project = Project.find_by_slug(params[:project_id], current_user)
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
if @project != nil
@wiki = Wiki.new
@title = "New " + @project.title + " Wiki Page"
@@ -85,7 +84,7 @@ class WikisController < ApplicationController
def create
#FIXME error check @project
- @project = Project.find_by_slug(params[:project_id], current_user)
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
@wiki = Wiki.new(params[:wiki])
@wiki.slug = to_slug(@wiki.title)
@wiki.project_id = @project.id
@@ -102,7 +101,7 @@ class WikisController < ApplicationController
def edit
if params[:project_id] != nil
- @project = Project.find_by_slug(params[:project_id], current_user)
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
if @project != nil
# Project wiki, page specfied
@wiki = Wiki.find_by_slug(params[:id])
@@ -133,7 +132,7 @@ class WikisController < ApplicationController
def update
if params[:project_id] != nil
- @project = Project.find_by_slug(params[:project_id], current_user)
+ @project, @member = Project.find_by_slug_public_or_member(params[:project_id], current_user)
if @project != nil
# Project wiki, page specfied
@wiki = Wiki.find_by_slug(params[:id]) |
| |   |
| 1 | 1 | # Methods added to this helper will be available to all templates in the application. |
| 2 | 2 | module ApplicationHelper |
| 3 | 3 | include TagsHelper |
| 4 | | |
| 4 | |
| 5 | 5 | def default_css_tag_sizes |
| 6 | 6 | %w(tag_size_1 tag_size_2 tag_size_3 tag_size_4) |
| 7 | 7 | end |
| … | … | |
| 326 | 326 | out |
| 327 | 327 | end |
| 328 | 328 | |
| 329 | | |
| 330 | 329 | def render_right_actionbox_complex (flags = {}) |
| 331 | 330 | out = %Q{<table class='right_default_table'>} |
| 332 | 331 | out << %Q{<tr><th>Actions</th></tr>} |
| 333 | 332 | # |
| 334 | | if logged_in? |
| 335 | | acts = "" |
| 336 | | acts << %Q{<li>#{link_to("Edit Wiki Page", edit_project_wiki_path(@project.slug, @wiki.slug))}</li>} if flags[:edit_project_wiki] |
| 337 | | acts << %Q{<li>#{link_to("New Wiki Page", new_project_wiki_path(@project.slug))}</li>} if flags[:new_project_wiki] |
| 338 | | acts << %Q{<li>#{link_to("List Wiki Pages", project_wikis_path(@project.slug))}</li>} if flags[:list_project_wikis] |
| 339 | | # |
| 340 | | acts << %Q{<li>#{link_to("Edit Article", edit_project_article_path(@project.slug, @article.slug))}</li>} if flags[:edit_article] |
| 341 | | acts << %Q{<li>#{link_to("New Article", new_project_article_path(@project.slug))}</li>} if flags[:new_article] |
| 342 | | acts << %Q{<li>#{link_to("New Milestone", new_project_milestone_path(@project.slug))}</li>} if flags[:new_milestone] |
| 343 | | acts << %Q{<li>#{link_to("New Ticket", new_project_ticket_path(@project.slug))}</li>} if flags[:new_ticket] |
| 344 | | acts << %Q{<li>#{link_to("Clone Mainline", new_project_repository_path(@project.slug, @repository))}</li>} if flags[:clone_mainline] |
| 345 | | out << %Q{<tr><td><ul>#{acts}</ul></td></tr>} if acts != "" |
| 346 | | end |
| 333 | #FIXME finish this, also it must must only be true if logged_in? |
| 334 | logged_in? ? is_member = true : is_member = false |
| 335 | acts = "" |
| 336 | acts << %Q{<li>#{link_to("Edit Wiki Page", edit_project_wiki_path(@project.slug, @wiki.slug))}</li>} if flags[:edit_project_wiki] && is_member |
| 337 | acts << %Q{<li>#{link_to("New Wiki Page", new_project_wiki_path(@project.slug))}</li>} if flags[:new_project_wiki] && is_member |
| 338 | acts << %Q{<li>#{link_to("List Wiki Pages", project_wikis_path(@project.slug))}</li>} if flags[:list_project_wikis] |
| 339 | acts << %Q{<li>#{link_to("Edit Article", edit_project_article_path(@project.slug, @article.slug))}</li>} if flags[:edit_article] && is_member |
| 340 | acts << %Q{<li>#{link_to("New Article", new_project_article_path(@project.slug))}</li>} if flags[:new_article] && is_member |
| 341 | acts << %Q{<li>#{link_to("New Milestone", new_project_milestone_path(@project.slug))}</li>} if flags[:new_milestone] && is_member |
| 342 | acts << %Q{<li>#{link_to("New Ticket", new_project_ticket_path(@project.slug))}</li>} if flags[:new_ticket] |
| 343 | acts << %Q{<li>#{link_to("Clone Mainline", new_project_repository_path(@project.slug, @repository))}</li>} if flags[:clone_mainline] && logged_in? |
| 344 | out << %Q{<tr><td><ul>#{acts}</ul></td></tr>} if acts != "" |
| 347 | 345 | out << %Q{<tr><td>#{render_right_actionbox_default(flags)}</td></tr>} |
| 348 | 346 | out << %Q{</table>} |
| 349 | 347 | out |
| 350 | 348 | end |
| 351 | | |
| 349 | |
| 352 | 350 | end |
| toggle raw diff |
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,7 +1,7 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
include TagsHelper
-
+
def default_css_tag_sizes
%w(tag_size_1 tag_size_2 tag_size_3 tag_size_4)
end
@@ -326,27 +326,25 @@ module ApplicationHelper
out
end
-
def render_right_actionbox_complex (flags = {})
out = %Q{<table class='right_default_table'>}
out << %Q{<tr><th>Actions</th></tr>}
#
- if logged_in?
- acts = ""
- acts << %Q{<li>#{link_to("Edit Wiki Page", edit_project_wiki_path(@project.slug, @wiki.slug))}</li>} if flags[:edit_project_wiki]
- acts << %Q{<li>#{link_to("New Wiki Page", new_project_wiki_path(@project.slug))}</li>} if flags[:new_project_wiki]
- acts << %Q{<li>#{link_to("List Wiki Pages", project_wikis_path(@project.slug))}</li>} if flags[:list_project_wikis]
- #
- acts << %Q{<li>#{link_to("Edit Article", edit_project_article_path(@project.slug, @article.slug))}</li>} if flags[:edit_article]
- acts << %Q{<li>#{link_to("New Article", new_project_article_path(@project.slug))}</li>} if flags[:new_article]
- acts << %Q{<li>#{link_to("New Milestone", new_project_milestone_path(@project.slug))}</li>} if flags[:new_milestone]
- acts << %Q{<li>#{link_to("New Ticket", new_project_ticket_path(@project.slug))}</li>} if flags[:new_ticket]
- acts << %Q{<li>#{link_to("Clone Mainline", new_project_repository_path(@project.slug, @repository))}</li>} if flags[:clone_mainline]
- out << %Q{<tr><td><ul>#{acts}</ul></td></tr>} if acts != ""
- end
+ #FIXME finish this, also it must must only be true if logged_in?
+ logged_in? ? is_member = true : is_member = false
+ acts = ""
+ acts << %Q{<li>#{link_to("Edit Wiki Page", edit_project_wiki_path(@project.slug, @wiki.slug))}</li>} if flags[:edit_project_wiki] && is_member
+ acts << %Q{<li>#{link_to("New Wiki Page", new_project_wiki_path(@project.slug))}</li>} if flags[:new_project_wiki] && is_member
+ acts << %Q{<li>#{link_to("List Wiki Pages", project_wikis_path(@project.slug))}</li>} if flags[:list_project_wikis]
+ acts << %Q{<li>#{link_to("Edit Article", edit_project_article_path(@project.slug, @article.slug))}</li>} if flags[:edit_article] && is_member
+ acts << %Q{<li>#{link_to("New Article", new_project_article_path(@project.slug))}</li>} if flags[:new_article] && is_member
+ acts << %Q{<li>#{link_to("New Milestone", new_project_milestone_path(@project.slug))}</li>} if flags[:new_milestone] && is_member
+ acts << %Q{<li>#{link_to("New Ticket", new_project_ticket_path(@project.slug))}</li>} if flags[:new_ticket]
+ acts << %Q{<li>#{link_to("Clone Mainline", new_project_repository_path(@project.slug, @repository))}</li>} if flags[:clone_mainline] && logged_in?
+ out << %Q{<tr><td><ul>#{acts}</ul></td></tr>} if acts != ""
out << %Q{<tr><td>#{render_right_actionbox_default(flags)}</td></tr>}
out << %Q{</table>}
out
end
-
+
end |
| |   |
| 98 | 98 | else |
| 99 | 99 | out << render_right_actionbox_complex(:allow_shortcuts => true, :edit_project_wiki => true, :new_project_wiki => true, :list_project_wikis => true) |
| 100 | 100 | end |
| 101 | | out << render_right_project_contributors |
| 102 | 101 | out << render_right_project_extrainfo |
| 102 | out << render_right_project_contributors |
| 103 | 103 | when PRJ_TAB_DOWNLOADS |
| 104 | 104 | out << render_right_actionbox_basic(:allow_shortcuts => true) |
| 105 | 105 | when PRJ_TAB_REPOS |
| … | … | |
| 135 | 135 | end |
| 136 | 136 | out |
| 137 | 137 | end |
| 138 | | |
| 139 | 138 | |
| 140 | 139 | def format_life_cycle (ls) |
| 141 | 140 | case ls |
| … | … | |
| 143 | 143 | when :mature_frozen |
| 144 | 144 | "Mature Frozen" |
| 145 | 145 | else |
| 146 | | ls.to_s.captilize |
| 146 | ls.to_s.capitalize |
| 147 | end |
| 148 | end |
| 149 | |
| 150 | |
| 151 | def format_member_accesslevel (al) |
| 152 | case al |
| 153 | when :readonly |
| 154 | "Read Only" |
| 155 | else |
| 156 | al.to_s.capitalize |
| 147 | 157 | end |
| 148 | 158 | end |
| 149 | 159 | |
| toggle raw diff |
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -98,8 +98,8 @@ module ProjectsHelper
else
out << render_right_actionbox_complex(:allow_shortcuts => true, :edit_project_wiki => true, :new_project_wiki => true, :list_project_wikis => true)
end
- out << render_right_project_contributors
out << render_right_project_extrainfo
+ out << render_right_project_contributors
when PRJ_TAB_DOWNLOADS
out << render_right_actionbox_basic(:allow_shortcuts => true)
when PRJ_TAB_REPOS
@@ -135,7 +135,6 @@ module ProjectsHelper
end
out
end
-
def format_life_cycle (ls)
case ls
@@ -144,7 +143,17 @@ module ProjectsHelper
when :mature_frozen
"Mature Frozen"
else
- ls.to_s.captilize
+ ls.to_s.capitalize
+ end
+ end
+
+
+ def format_member_accesslevel (al)
+ case al
+ when :readonly
+ "Read Only"
+ else
+ al.to_s.capitalize
end
end
|
| |   |
| 5 | 5 | |
| 6 | 6 | protected |
| 7 | 7 | |
| 8 | | # |
| 9 | 8 | def self.find_by_search(phrase) |
| 10 | 9 | #find(:all, :conditions => ["status = '#{:published}' AND title like ?", "%" << phrase << "%"]) |
| 11 | 10 | end |
| 12 | 11 | |
| 13 | | # |
| 14 | 12 | def self.find_by_project(project_id) |
| 15 | 13 | find(:all, :conditions => ["project_id = '#{project_id}'"], :order => "accesslevel DESC") |
| 16 | 14 | end |
| 17 | 15 | |
| 18 | | # |
| 19 | 16 | def self.find_by_user(user_id) |
| 20 | 17 | find(:all, :conditions => ["user_id = '#{user_id}'"]) |
| 21 | 18 | end |
| 22 | 19 | |
| 23 | | # |
| 24 | 20 | def self.is_member? (project_id, user_id) |
| 25 | | if find(:first, :conditions => ["project_id = '#{project_id}' AND user_id = '#{user_id}'"]) != nil then |
| 26 | | return true |
| 21 | if find(:first, :conditions => ["project_id = '#{project_id}' AND user_id = '#{user_id}'"]) != nil |
| 22 | true |
| 27 | 23 | else |
| 28 | | return false |
| 24 | false |
| 29 | 25 | end |
| 30 | 26 | end |
| 31 | 27 | |
| toggle raw diff |
--- a/app/models/appcast/member.rb
+++ b/app/models/appcast/member.rb
@@ -5,27 +5,23 @@ class Member < ActiveRecord::Base
protected
- #
def self.find_by_search(phrase)
#find(:all, :conditions => ["status = '#{:published}' AND title like ?", "%" << phrase << "%"])
end
- #
def self.find_by_project(project_id)
find(:all, :conditions => ["project_id = '#{project_id}'"], :order => "accesslevel DESC")
end
- #
def self.find_by_user(user_id)
find(:all, :conditions => ["user_id = '#{user_id}'"])
end
- #
def self.is_member? (project_id, user_id)
- if find(:first, :conditions => ["project_id = '#{project_id}' AND user_id = '#{user_id}'"]) != nil then
- return true
+ if find(:first, :conditions => ["project_id = '#{project_id}' AND user_id = '#{user_id}'"]) != nil
+ true
else
- return false
+ false
end
end
|
| |   |
| 1 | 1 | class Project < ActiveRecord::Base |
| 2 | | acts_as_taggable |
| 2 | acts_as_taggable if $application_mode != MODE_APPCAST |
| 3 | 3 | |
| 4 | 4 | belongs_to :user |
| 5 | 5 | has_many :comments, :dependent => :destroy |
| … | … | |
| 188 | 188 | ) |
| 189 | 189 | end |
| 190 | 190 | |
| 191 | | # |
| 192 | | def self.find_by_slug_secure(slug, curruser) |
| 191 | def self.find_by_slug_public_or_member(slug, curruser) |
| 193 | 192 | projects_allowed = Project.list_for_user(curruser) |
| 194 | | find(:first, :conditions => ["status = '#{:active}' AND slug = '#{slug}' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"]) |
| 193 | project = find(:first, :conditions => ["status = '#{:active}' AND slug = '#{slug}' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"]) |
| 194 | #TODO this can be found from the above |
| 195 | if project |
| 196 | member = Member.is_member?(project.id, curruser.id) |
| 197 | else |
| 198 | member = false |
| 199 | end |
| 200 | return project, member |
| 195 | 201 | end |
| 196 | | |
| 202 | |
| 197 | 203 | # takes a list of project_ids e.g. '1','2','3' |
| 198 | 204 | def self.find_by_list (list, curruser) |
| 199 | 205 | projects_allowed = Project.list_for_user(curruser) |
| … | … | |
| 208 | 208 | |
| 209 | 209 | # |
| 210 | 210 | # Get a list of project_ids of a user is a members of in the format '1','2','3' |
| 211 | | # FIXME this should be in a helper I think |
| 212 | 211 | # |
| 213 | 212 | def self.list_for_user(user) |
| 214 | | #if user != nil then |
| 215 | | # list = "" |
| 216 | | # projects = Member.find_by_user(user.id) |
| 217 | | # if projects.size > 0 then |
| 218 | | # start = true |
| 219 | | # for project in projects |
| 220 | | # if not start then |
| 221 | | # list = list << "," |
| 222 | | # else |
| 223 | | # start = false |
| 224 | | # end |
| 225 | | # list = list << "'" << project.project_id.to_s << "'" |
| 226 | | # end |
| 227 | | # return list |
| 228 | | # else |
| 229 | | # return "'1'" # see below |
| 230 | | # end |
| 231 | | #else |
| 213 | if user != nil then |
| 214 | list = "" |
| 215 | projects = Member.find_by_user(user.id) |
| 216 | if projects.size > 0 then |
| 217 | start = true |
| 218 | for project in projects |
| 219 | if not start then |
| 220 | list = list << "," |
| 221 | else |
| 222 | start = false |
| 223 | end |
| 224 | list = list << "'" << project.project_id.to_s << "'" |
| 225 | end |
| 226 | return list |
| 227 | else |
| 228 | return "'1'" # see below |
| 229 | end |
| 230 | else |
| 232 | 231 | return "'1'" # Project.id 1 is no project (this is a bit of a frig really, without it 2 queries will be needed for all finds) |
| 233 | | #end |
| 232 | end |
| 234 | 233 | end |
| 235 | 234 | |
| 236 | 235 | def self.tab_settings (tab) |
| toggle raw diff |
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,5 +1,5 @@
class Project < ActiveRecord::Base
- acts_as_taggable
+ acts_as_taggable if $application_mode != MODE_APPCAST
belongs_to :user
has_many :comments, :dependent => :destroy
@@ -188,12 +188,18 @@ class Project < ActiveRecord::Base
)
end
- #
- def self.find_by_slug_secure(slug, curruser)
+ def self.find_by_slug_public_or_member(slug, curruser)
projects_allowed = Project.list_for_user(curruser)
- find(:first, :conditions => ["status = '#{:active}' AND slug = '#{slug}' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"])
+ project = find(:first, :conditions => ["status = '#{:active}' AND slug = '#{slug}' AND ( audience = '#{:public}' OR projects.id IN (" << projects_allowed << ") )"])
+ #TODO this can be found from the above
+ if project
+ member = Member.is_member?(project.id, curruser.id)
+ else
+ member = false
+ end
+ return project, member
end
-
+
# takes a list of project_ids e.g. '1','2','3'
def self.find_by_list (list, curruser)
projects_allowed = Project.list_for_user(curruser)
@@ -202,29 +208,28 @@ class Project < ActiveRecord::Base
#
# Get a list of project_ids of a user is a members of in the format '1','2','3'
- # FIXME this should be in a helper I think
#
def self.list_for_user(user)
- #if user != nil then
- # list = ""
- # projects = Member.find_by_user(user.id)
- # if projects.size > 0 then
- # start = true
- # for project in projects
- # if not start then
- # list = list << ","
- # else
- # start = false
- # end
- # list = list << "'" << project.project_id.to_s << "'"
- # end
- # return list
- # else
- # return "'1'" # see below
- # end
- #else
+ if user != nil then
+ list = ""
+ projects = Member.find_by_user(user.id)
+ if projects.size > 0 then
+ start = true
+ for project in projects
+ if not start then
+ list = list << ","
+ else
+ start = false
+ end
+ list = list << "'" << project.project_id.to_s << "'"
+ end
+ return list
+ else
+ return "'1'" # see below
+ end
+ else
return "'1'" # Project.id 1 is no project (this is a bit of a frig really, without it 2 queries will be needed for all finds)
- #end
+ end
end
def self.tab_settings (tab) |
| |   |
| 8 | 8 | <table class='public'> |
| 9 | 9 | |
| 10 | 10 | <tr> |
| 11 | | <th>ID</th> |
| 12 | | <th width='260'>Title</th> |
| 13 | | <th>Status</th> |
| 14 | | <th>Format</th> |
| 15 | | <th>Slug</th> |
| 16 | | <th>Created</th> |
| 17 | | <th colspan='2'></th> |
| 11 | <th width='<%= STYLE_TABLE_COL_WIDTH_ID %>'>ID</th> |
| 12 | <th>Title</th> |
| 13 | <% if @member %> |
| 14 | <th width='100'>Status</th> |
| 15 | <th width='100'>Format</th> |
| 16 | <th width='180'>Slug</th> |
| 17 | <% end %> |
| 18 | <th width='<%= STYLE_TABLE_COL_WIDTH_DDMMYYHHMM %>'>Created</th> |
| 19 | <% if @member %> |
| 20 | <th colspan='2' width='<%= STYLE_TABLE_COL_WIDTH_ACTION_SHORT.to_i * 2 %>'></th> |
| 21 | <% end %> |
| 18 | 22 | </tr> |
| 19 | 23 | |
| 20 | 24 | <% for wiki in @wikis %> |
| 21 | 25 | <tr> |
| 22 | 26 | <td><%= wiki.id %></td> |
| 23 | | <td><%= wiki.title %></td> |
| 24 | | <td><%= wiki.status.to_s.capitalize %></td> |
| 25 | | <td><%= wiki.format.to_s.capitalize %></td> |
| 26 | | <td>/<%= wiki.slug %></td> |
| 27 | | <td><%= format_datetime_ddmmyyhhmm(wiki.created_at) %></td> |
| 28 | | <td>Edit</td> |
| 29 | | <td>Del</td> |
| 27 | <td><%= link_to wiki.title, project_wiki_path(@project.slug, wiki.slug) %></td> |
| 28 | <% if @member %> |
| 29 | <td><%= wiki.status.to_s.capitalize %></td> |
| 30 | <td><%= wiki.format.to_s.capitalize %></td> |
| 31 | <td>/<%= wiki.slug %></td> |
| 32 | <% end %> |
| 33 | <td><%= format_datetime_ddmmyyhhmm(wiki.created_at) %></td> |
| 34 | <% if @member %> |
| 35 | <td>Edit</td> |
| 36 | <td>Del</td> |
| 37 | <% end %> |
| 30 | 38 | </tr> |
| 31 | 39 | <% end %> |
| 32 | 40 | |
| toggle raw diff |
--- a/app/views/wikis/ac_project_index.html.erb
+++ b/app/views/wikis/ac_project_index.html.erb
@@ -8,25 +8,33 @@
<table class='public'>
<tr>
- <th>ID</th>
- <th width='260'>Title</th>
- <th>Status</th>
- <th>Format</th>
- <th>Slug</th>
- <th>Created</th>
- <th colspan='2'></th>
+ <th width='<%= STYLE_TABLE_COL_WIDTH_ID %>'>ID</th>
+ <th>Title</th>
+ <% if @member %>
+ <th width='100'>Status</th>
+ <th width='100'>Format</th>
+ <th width='180'>Slug</th>
+ <% end %>
+ <th width='<%= STYLE_TABLE_COL_WIDTH_DDMMYYHHMM %>'>Created</th>
+ <% if @member %>
+ <th colspan='2' width='<%= STYLE_TABLE_COL_WIDTH_ACTION_SHORT.to_i * 2 %>'></th>
+ <% end %>
</tr>
<% for wiki in @wikis %>
<tr>
<td><%= wiki.id %></td>
- <td><%= wiki.title %></td>
- <td><%= wiki.status.to_s.capitalize %></td>
- <td><%= wiki.format.to_s.capitalize %></td>
- <td>/<%= wiki.slug %></td>
- <td><%= format_datetime_ddmmyyhhmm(wiki.created_at) %></td>
- <td>Edit</td>
- <td>Del</td>
+ <td><%= link_to wiki.title, project_wiki_path(@project.slug, wiki.slug) %></td>
+ <% if @member %>
+ <td><%= wiki.status.to_s.capitalize %></td>
+ <td><%= wiki.format.to_s.capitalize %></td>
+ <td>/<%= wiki.slug %></td>
+ <% end %>
+ <td><%= format_datetime_ddmmyyhhmm(wiki.created_at) %></td>
+ <% if @member %>
+ <td>Edit</td>
+ <td>Del</td>
+ <% end %>
</tr>
<% end %>
|
| |   |
| 164 | 164 | #comments .commentdate { font-size: 0.8em; } |
| 165 | 165 | |
| 166 | 166 | /* Footer Section */ |
| 167 | | #footer { clear: left; height: 600px; margin: 60px 0px 0px 0px; padding: 3px; border-top: 1px solid #aaa; background-color: #ededed; } |
| 167 | #footer { clear: left; height: 600px; margin: 60px 360px 0px 0px; padding: 3px; border-top: 1px solid #aaa; background-color: #fff; } |
| 168 | 168 | #footer .text { margin: 0px 0px 0px 2px; font-size: 0.8em; color: #666; } |
| 169 | 169 | |
| 170 | 170 | table.admin_vert { margin-top: 20px; margin-bottom: 10px; background-color: #aaa; border-spacing: 1px; } |
| … | … | |
| 188 | 188 | table.right_archive_summary td { font-size: 0.9em; text-align: center; margin: 0px; padding: 1px; } |
| 189 | 189 | |
| 190 | 190 | table.right_default_table { border: 2px solid #eee; width: 100%; margin: 0px 0px 20px 0px; border-spacing: 0px; } |
| 191 | | table.right_default_table th { font-weight: 800; text-align: left; background-color: #eee; border: 0px; margin: 0px; padding: 6px 10px 6px 10px; } |
| 192 | | table.right_default_table td { vertical-align: top; text-align: left; background-color: #fbfbfb; border: 0px; margin: 0px; padding: 6px 10px 6px 10px; } |
| 191 | table.right_default_table th { font-weight: 800; text-align: left; background-color: #eee; border: 0px; margin: 0px; padding: 4px 10px 4px 10px; } |
| 192 | table.right_default_table td { vertical-align: top; text-align: left; background-color: #fbfbfb; border: 0px; margin: 0px; padding: 4px 5px 4px 10px; } |
| 193 | 193 | table.right_default_table .count { font-size: 0.9em; } |
| 194 | 194 | /* |
| 195 | 195 | table.releasedownload { margin-top: 10px; margin-bottom: 20px; background-color: #fff; border-spacing: 0px; } |
| toggle raw diff |
--- a/public/stylesheets/appcast.css
+++ b/public/stylesheets/appcast.css
@@ -164,7 +164,7 @@ html>body #content_withrightcolumn {height: auto;}
#comments .commentdate { font-size: 0.8em; }
/* Footer Section */
-#footer { clear: left; height: 600px; margin: 60px 0px 0px 0px; padding: 3px; border-top: 1px solid #aaa; background-color: #ededed; }
+#footer { clear: left; height: 600px; margin: 60px 360px 0px 0px; padding: 3px; border-top: 1px solid #aaa; background-color: #fff; }
#footer .text { margin: 0px 0px 0px 2px; font-size: 0.8em; color: #666; }
table.admin_vert { margin-top: 20px; margin-bottom: 10px; background-color: #aaa; border-spacing: 1px; }
@@ -188,8 +188,8 @@ table.right_archive_summary th { background-color: #fff; text-align: left; font-
table.right_archive_summary td { font-size: 0.9em; text-align: center; margin: 0px; padding: 1px; }
table.right_default_table { border: 2px solid #eee; width: 100%; margin: 0px 0px 20px 0px; border-spacing: 0px; }
-table.right_default_table th { font-weight: 800; text-align: left; background-color: #eee; border: 0px; margin: 0px; padding: 6px 10px 6px 10px; }
-table.right_default_table td { vertical-align: top; text-align: left; background-color: #fbfbfb; border: 0px; margin: 0px; padding: 6px 10px 6px 10px; }
+table.right_default_table th { font-weight: 800; text-align: left; background-color: #eee; border: 0px; margin: 0px; padding: 4px 10px 4px 10px; }
+table.right_default_table td { vertical-align: top; text-align: left; background-color: #fbfbfb; border: 0px; margin: 0px; padding: 4px 5px 4px 10px; }
table.right_default_table .count { font-size: 0.9em; }
/*
table.releasedownload { margin-top: 10px; margin-bottom: 20px; background-color: #fff; border-spacing: 0px; } |