修改forge,localhost首页不能显示的问题
This commit is contained in:
parent
09ea833dcb
commit
528af32f91
|
@ -296,9 +296,9 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def find_contest_from_association
|
||||
render_404 unless @object.present?
|
||||
render_404 unless @contest.present?
|
||||
|
||||
@contest = @object.contest
|
||||
@contest = @contest.contest
|
||||
end
|
||||
|
||||
def find_model_object
|
||||
|
|
|
@ -54,9 +54,9 @@ class CommentsController < ApplicationController
|
|||
|
||||
def find_model_object_contest
|
||||
super
|
||||
@contestnotification = @object
|
||||
@contestnotifications = @object
|
||||
@comment = nil
|
||||
@contestnotification
|
||||
@contestnotifications
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -28,23 +28,23 @@ class ContestnotificationsController < ApplicationController
|
|||
@limit = 10
|
||||
end
|
||||
|
||||
scope = @contest ? @contest.contestnotification.visible : Contestnotification.visible
|
||||
scope = @contest ? @contest.contestnotifications.visible : Contestnotifications.visible
|
||||
|
||||
@contestnotification_count = scope.count
|
||||
@contestnotification_pages = Paginator.new @contestnotification_count, @limit, params['page']
|
||||
@offset ||= @contestnotification_pages.offset
|
||||
@contestnotifications = scope.all(:include => [:author, :contest],
|
||||
@contestnotificationss = scope.all(:include => [:author, :contest],
|
||||
:order => "#{Contestnotification.table_name}.created_on DESC",
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@contestnotification = Contestnotification.new # for adding news inline
|
||||
@contestnotifications = Contestnotifications.new # for adding news inline
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
format.api
|
||||
format.atom { render_feed(@contestnotifications, :title => (@contest ? @contest.name : Setting.app_title) + ": #{l(:label_contest_notification)}") }
|
||||
format.atom { render_feed(@contestnotificationss, :title => (@contest ? @contest.name : Setting.app_title) + ": #{l(:label_contest_notification)}") }
|
||||
end
|
||||
### end ###
|
||||
end
|
||||
|
@ -58,7 +58,7 @@ class ContestnotificationsController < ApplicationController
|
|||
# format.html # show.html.erb
|
||||
# format.json { render json: @contestnotification }
|
||||
# end
|
||||
@comments = @contestnotification.comments
|
||||
@comments = @contestnotifications.comments
|
||||
@comments.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
render :layout => 'base_contest'
|
||||
|
||||
|
@ -73,7 +73,7 @@ class ContestnotificationsController < ApplicationController
|
|||
# format.html # new.html.erb
|
||||
# format.json { render json: @contestnotification }
|
||||
# end
|
||||
@contestnotification = Contestnotification.new(:contest => @contest, :author => User.current)
|
||||
@contestnotifications = Contestnotifications.new(:contest => @contest, :author => User.current)
|
||||
render :layout => 'base_contest'
|
||||
end
|
||||
|
||||
|
@ -96,11 +96,11 @@ class ContestnotificationsController < ApplicationController
|
|||
# format.json { render json: @contestnotification.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
@contestnotification = Contestnotification.new(:contest => @contest, :author => User.current)
|
||||
@contestnotification.safe_attributes = params[:contestnotification]
|
||||
@contestnotifications = Contestnotifications.new(:contest => @contest, :author => User.current)
|
||||
@contestnotifications.safe_attributes = params[:contestnotifications]
|
||||
@news.save_attachments(params[:attachments])
|
||||
if @contestnotification.save
|
||||
render_attachment_warning_if_needed(@contestnotification)
|
||||
if @contestnotifications.save
|
||||
render_attachment_warning_if_needed(@contestnotifications)
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to project_news_index_path(@contest)
|
||||
else
|
||||
|
@ -123,12 +123,12 @@ class ContestnotificationsController < ApplicationController
|
|||
# format.json { render json: @contestnotification.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
@contestnotification.safe_attributes = params[:contestnotification]
|
||||
@contestnotification.save_attachments(params[:attachments])
|
||||
if @contestnotification.save
|
||||
render_attachment_warning_if_needed(@contestnotification)
|
||||
@contestnotifications.safe_attributes = params[:contestnotifications]
|
||||
@contestnotifications.save_attachments(params[:attachments])
|
||||
if @contestnotifications.save
|
||||
render_attachment_warning_if_needed(@contestnotifications)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to contestnotification_path(@contestnotification)
|
||||
redirect_to contestnotification_path(@contestnotifications)
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
|
@ -144,7 +144,7 @@ class ContestnotificationsController < ApplicationController
|
|||
# format.html { redirect_to contestnotifications_url }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
@contestnotification.destroy
|
||||
@contestnotifications.destroy
|
||||
redirect_to contest_contestnotification_index_path(@contest)
|
||||
end
|
||||
|
||||
|
|
|
@ -319,9 +319,10 @@ module WelcomeHelper
|
|||
"show_documents" => true,
|
||||
"show_messages" => true,
|
||||
"show_news" => true,
|
||||
"show_bids" => true
|
||||
"show_bids" => true,
|
||||
"show_contest" => true
|
||||
}
|
||||
activity.scope_select{|t| ['changesets', 'documents', 'memos', 'messages', 'journals_for_messages', 'bids', 'news'].include?(t) ? nil : 'You may think you know what the following code does, may be. but why don"t you close this file and go play with something else, Now?' }
|
||||
activity.scope_select{|t| ['changesets', 'documents', 'memos', 'messages', 'journals_for_messages', 'bids', 'news', 'contestnotification'].include?(t) ? nil : 'You may think you know what the following code does, may be. but why don"t you close this file and go play with something else, Now?' }
|
||||
activity.events_welcome(nil, nil, {:limit => limit, :types => 'welcome'})
|
||||
end
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class Contestnotification < ActiveRecord::Base
|
|||
|
||||
# returns latest news for contests visible by user
|
||||
def self.latest(user = User.current, count = 5)
|
||||
visible(user).includes([:author, :contest]).order("#{Contestnotification.table_name}.created_on DESC").limit(count).all
|
||||
visible(user).includes([:author, :contest]).order("#{Contestnotifications.table_name}.created_on DESC").limit(count).all
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
|
||||
<td><table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%=link_to contestnotification.author,contestnotification_path(contestnotification)%></strong>
|
||||
<a class="font_lighter"><%= l(:label_project_newshare) %></a> <%= link_to h(contestnotification.title), news_path(contestnotification) %>
|
||||
<td colspan="2" valign="top"><strong> <%=link_to contestnotifications.author,contestnotifications_path(contestnotifications)%></strong>
|
||||
<a class="font_lighter"><%= l(:label_project_newshare) %></a> <%= link_to h(contestnotifications.title), news_path(contestnotifications) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" ><p class="font_description"><%=h contestnotification.description%></p></td>
|
||||
<td colspan="2" width="580px" ><p class="font_description"><%=h contestnotifications.description%></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><a class="font_lighter"> <%= contestnotification.created_on %></a></td>
|
||||
<td width="200" align="right" class="a"><%= link_to l(:label_project_newother),contestnotification_path(contestnotification)%>
|
||||
<%= "(#{l(:label_x_comments, :count => contestnotification.comments_count)})" if contestnotification.comments_count > 0 %>
|
||||
<td align="left"><a class="font_lighter"> <%= contestnotifications.created_on %></a></td>
|
||||
<td width="200" align="right" class="a"><%= link_to l(:label_project_newother),contestnotifications_path(contestnotifications)%>
|
||||
<%= "(#{l(:label_x_comments, :count => contestnotifications.comments_count)})" if contestnotifications.comments_count > 0 %>
|
||||
</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<% end %> -->
|
||||
|
||||
|
||||
<%= error_messages_for @contestnotification %>
|
||||
<%= error_messages_for @contestnotifications %>
|
||||
<div class="add_frame_header" >
|
||||
<% str =l(:label_news_new) %>
|
||||
</div>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
|
||||
<!-- <p style="margin-left:-10px;"><%= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
|
||||
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @contestnotification} %></p>
|
||||
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @contestnotifications} %></p>
|
||||
</div>
|
||||
|
||||
<%= wikitoolbar_for 'news_description' %>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
<h3><%=l(:label_news)%></h3>
|
||||
|
||||
<%= labelled_form_for @contestnotification, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
|
||||
<%= labelled_form_for @contestnotifications, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= preview_link preview_news_path(:project_id => @contest, :id => @contestnotification), 'news-form' %>
|
||||
<%= preview_link preview_news_path(:project_id => @contest, :id => @contestnotifications), 'news-form' %>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
||||
|
|
|
@ -49,11 +49,11 @@
|
|||
|
||||
<% if @contest && User.current.allowed_to?(:manage_news, @contest) %>
|
||||
<div id="add-news" class="add_frame" style="display:none;">
|
||||
<%= labelled_form_for @contestnotification, :url => contest_contestnotification_index_path(@contest),
|
||||
<%= labelled_form_for @contestnotifications, :url => contest_contestnotifications_index_path(@contest),
|
||||
:html => {:id => 'news-form', :multipart => true} do |f| %>
|
||||
<%= render :partial => 'news/form', :locals => {:f => f} %>
|
||||
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> |
|
||||
<%= preview_link preview_contestnotification_path(:contest_id => @contest), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
||||
<%= preview_link preview_contestnotifications_path(:contest_id => @contest), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
||||
|
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %>
|
||||
<% end if @contest %>
|
||||
|
@ -61,33 +61,33 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<% if @contestnotifications.empty? %>
|
||||
<% if @contestnotificationss.empty? %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% else %>
|
||||
<% @contestnotifications.each do |contestnotification| %>
|
||||
<% @contestnotificationss.each do |contestnotifications| %>
|
||||
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(contestnotification.author), :class => "avatar"), user_path(contestnotification.author) %></td>
|
||||
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(contestnotifications.author), :class => "avatar"), user_path(contestnotifications.author) %></td>
|
||||
<td>
|
||||
<table width="580px" border="0">
|
||||
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to_user(contestnotification.author) if contestnotification.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_notice) %></span><span><%= link_to h(news.title), news_path(news) %></span>
|
||||
<span style="float: right"><%= delete_link contestnotification_path(news) if User.current.allowed_to?(:manage_contestnotification, @contest) %> </span>
|
||||
<strong><%= link_to_user(contestnotifications.author) if contestnotifications.respond_to?(:author) %></strong><span style="margin-left: 4px;" class="font_lighter"><%= l(:label_project_notice) %></span><span><%= link_to h(news.title), news_path(news) %></span>
|
||||
<span style="float: right"><%= delete_link contestnotifications_path(news) if User.current.allowed_to?(:manage_contestnotification, @contest) %> </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px">
|
||||
<span class="font_description"><%= textilizable(contestnotification, :description) %></span></td>
|
||||
<span class="font_description"><%= textilizable(contestnotifications, :description) %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= l :label_update_time %>
|
||||
: <%= format_time(contestnotification.created_at) %></span></td>
|
||||
<td width="350" align="right" class="a"><%= link_to l(:label_project_newother), contestnotification_path(contestnotification) %><%= "(#{l(:label_x_comments, :count => contestnotification.comments_count)})" if contestnotification.comments_count >= 0 %></td>
|
||||
: <%= format_time(contestnotifications.created_at) %></span></td>
|
||||
<td width="350" align="right" class="a"><%= link_to l(:label_project_newother), contestnotifications_path(contestnotifications) %><%= "(#{l(:label_x_comments, :count => contestnotifications.comments_count)})" if contestnotifications.comments_count >= 0 %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- <h3><%=l(:label_news_new)%></h3> -->
|
||||
|
||||
<%= labelled_form_for @contestnotification, :url => contest_contestnotification_index_path(@contest),
|
||||
<%= labelled_form_for @contestnotifications, :url => contest_contestnotifications_index_path(@contest),
|
||||
:html => { :id => 'news-form', :multipart => true } do |f| %>
|
||||
<%= render :partial => 'news/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
||||
|
|
|
@ -36,24 +36,24 @@
|
|||
|
||||
<!--begin-->
|
||||
<div class="contextual">
|
||||
<%= watcher_link(@contestnotification, User.current) %>
|
||||
<%= watcher_link(@contestnotifications, User.current) %>
|
||||
<%= link_to(l(:button_edit),
|
||||
edit_news_path(@news),
|
||||
:class => 'icon icon-edit',
|
||||
:accesskey => accesskey(:edit),
|
||||
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_contestnotification, @contest) %>
|
||||
<%= delete_link news_path(@contestnotification) if User.current.allowed_to?(:manage_contestnotification, @contest) %>
|
||||
<%= delete_link news_path(@contestnotifications) if User.current.allowed_to?(:manage_contestnotification, @contest) %>
|
||||
</div>
|
||||
|
||||
<h3><strong><%=h @contestnotification.title %></strong></h3>
|
||||
<h3><strong><%=h @contestnotifications.title %></strong></h3>
|
||||
|
||||
<% if authorize_for('contestnotification', 'edit') %>
|
||||
<% if authorize_for('contestnotifications', 'edit') %>
|
||||
<div id="edit-news" style="display:none;">
|
||||
<%= labelled_form_for :contestnotification, @contestnotification, :url => contestnotification_path(@contestnotification),
|
||||
<%= labelled_form_for :contestnotifications, @contestnotifications, :url => contestnotifications_path(@contestnotifications),
|
||||
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= preview_link preview_contestnotification_path(:contest_id => @contest, :id => @contestnotification), 'news-form',target='preview',{:class => ''} %> |
|
||||
<%= preview_link preview_contestnotifications_path(:contest_id => @contest, :id => @contestnotifications), 'news-form',target='preview',{:class => ''} %> |
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
@ -63,16 +63,16 @@
|
|||
<div id="comments" style="margin-bottom:16px;">
|
||||
|
||||
<div style="margin:15px">
|
||||
<span class="font_description"> <%= textilizable(@contestnotification, :description) %> </span>
|
||||
<span class="font_description"> <%= textilizable(@contestnotifications, :description) %> </span>
|
||||
<br/>
|
||||
<%= link_to_attachments @contestnotification %>
|
||||
<%= link_to_attachments @contestnotifications %>
|
||||
<br/>
|
||||
<!--add comment-->
|
||||
<% if @contestnotification.commentable? %>
|
||||
<% if @contestnotifications.commentable? %>
|
||||
<p>
|
||||
<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
|
||||
</p>
|
||||
<%= form_tag({:controller => 'comments', :action => 'create', :id => @contestnotification}, :id => "add_comment_form", :style => "display:none;") do %>
|
||||
<%= form_tag({:controller => 'comments', :action => 'create', :id => @contestnotifications}, :id => "add_comment_form", :style => "display:none;") do %>
|
||||
<div class="box">
|
||||
<%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
|
||||
<%= wikitoolbar_for 'comment_comments' %>
|
||||
|
@ -83,7 +83,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% html_title @contestnotification.title -%>
|
||||
<% html_title @contestnotifications.title -%>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'scm' %>
|
||||
|
@ -112,7 +112,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= format_time(comment.created_on) %></span></td>
|
||||
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @contestnotification, :comment_id => comment},
|
||||
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @contestnotifications, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
|
|
|
@ -147,8 +147,8 @@ Redmine::AccessControl.map do |map|
|
|||
end
|
||||
|
||||
map.project_module :contestnotification do |map|
|
||||
map.permission :manage_contestnotification, {:contestnotification => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
map.permission :view_contestnotification, {:contestnotification => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :manage_contestnotification, {:contestnotifications => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
map.permission :view_contestnotification, {:contestnotifications => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :comment_contestnotification, {:comments => :create}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue