layout "site"
before_action :authorize_web
+ before_action :set_locale
before_action :require_user
before_action :check_permission
before_action :find_issue, :only => [:show, :resolve, :reopen, :ignore]
@issue_types.concat %w[DiaryEntry DiaryComment User] if current_user.administrator?
@users = User.joins(:roles).where(:user_roles => { :role => current_user.roles.map(&:role) }).distinct
- @issues = Issue.where(:assigned_role => current_user.roles.map(&:role))
+ @issues = Issue.visible_to(current_user)
# If search
if params[:search_by_user] && params[:search_by_user].present?
if @find_user
@issues = @issues.where(:reported_user_id => @find_user.id)
else
- notice = t("issues.index.user_not_found")
+ @issues = @issues.none
+ flash.now[:warning] = t(".user_not_found")
end
end
last_updated_by = params[:last_updated_by].to_s == "nil" ? nil : params[:last_updated_by].to_i
@issues = @issues.where(:updated_by => last_updated_by)
end
-
- redirect_to issues_path, :notice => notice if notice
end
def show
def resolve
if @issue.resolve
@issue.save!
- redirect_to @issue, :notice => t("issues.resolved")
+ redirect_to @issue, :notice => t(".resolved")
else
render :show
end
if @issue.ignore
@issue.updated_by = current_user.id
@issue.save!
- redirect_to @issue, :notice => t("issues.ignored")
+ redirect_to @issue, :notice => t(".ignored")
else
render :show
end
if @issue.reopen
@issue.updated_by = current_user.id
@issue.save!
- redirect_to @issue, :notice => t("issues.reopened")
+ redirect_to @issue, :notice => t(".reopened")
else
render :show
end