Commit ac525a74 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1219 from tsigo/ruby19_hashes

Fully embrace Ruby 1.9 hash syntax
parents 1413c23c 42d3295d
class CommitLoad < BaseContext
def execute
result = {
:commit => nil,
:suppress_diff => false,
:line_notes => [],
:notes_count => 0,
:note => nil
commit: nil,
suppress_diff: false,
line_notes: [],
notes_count: 0,
note: nil
}
commit = project.commit(params[:id])
......
......@@ -12,12 +12,12 @@ class IssuesBulkUpdateContext < BaseContext
opts[:assignee_id] = assignee_id if assignee_id.present?
opts[:closed] = (status == "closed") if status.present?
issues = Issue.where(:id => issues_ids).all
issues = Issue.where(id: issues_ids).all
issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
issues.each { |issue| issue.update_attributes(opts) }
{
:count => issues.count,
:success => !issues.count.zero?
count: issues.count,
success: !issues.count.zero?
}
end
end
......
......@@ -2,7 +2,7 @@ class Admin::ProjectsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
before_filter :admin_project, :only => [:edit, :show, :update, :destroy, :team_update]
before_filter :admin_project, only: [:edit, :show, :update, :destroy, :team_update]
def index
@admin_projects = Project.scoped
......@@ -36,7 +36,7 @@ class Admin::ProjectsController < ApplicationController
if @admin_project.save
redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
else
render :action => "new"
render action: "new"
end
end
......@@ -50,7 +50,7 @@ class Admin::ProjectsController < ApplicationController
if @admin_project.update_attributes(params[:project])
redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
else
render :action => "edit"
render action: "edit"
end
end
......
......@@ -34,7 +34,7 @@ class Admin::UsersController < ApplicationController
def new
@admin_user = User.new(:projects_limit => Gitlab.config.default_projects_limit)
@admin_user = User.new(projects_limit: Gitlab.config.default_projects_limit)
end
def edit
......
......@@ -11,15 +11,15 @@ class ApplicationController < ActionController::Base
helper_method :abilities, :can?
rescue_from Gitlab::Gitolite::AccessDenied do |exception|
render "errors/gitolite", :layout => "error"
render "errors/gitolite", layout: "error"
end
rescue_from Encoding::CompatibilityError do |exception|
render "errors/encoding", :layout => "error", :status => 404
render "errors/encoding", layout: "error", status: 404
end
rescue_from ActiveRecord::RecordNotFound do |exception|
render "errors/not_found", :layout => "error", :status => 404
render "errors/not_found", layout: "error", status: 404
end
layout :layout_by_resource
......@@ -97,15 +97,15 @@ class ApplicationController < ActionController::Base
end
def access_denied!
render "errors/access_denied", :layout => "error", :status => 404
render "errors/access_denied", layout: "error", status: 404
end
def not_found!
render "errors/not_found", :layout => "error", :status => 404
render "errors/not_found", layout: "error", status: 404
end
def git_not_found!
render "errors/git_not_found", :layout => "error", :status => 404
render "errors/git_not_found", layout: "error", status: 404
end
def method_missing(method_sym, *arguments, &block)
......@@ -127,7 +127,7 @@ class ApplicationController < ActionController::Base
end
def render_404
render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
end
def require_non_empty_project
......
......@@ -9,7 +9,7 @@ class CommitsController < ApplicationController
before_filter :authorize_read_project!
before_filter :authorize_code_access!
before_filter :require_non_empty_project
before_filter :load_refs, :only => :index # load @branch, @tag & @ref
before_filter :load_refs, only: :index # load @branch, @tag & @ref
before_filter :render_full_content
def index
......@@ -22,7 +22,7 @@ class CommitsController < ApplicationController
respond_to do |format|
format.html # index.html.erb
format.js
format.atom { render :layout => false }
format.atom { render layout: false }
end
end
......@@ -61,9 +61,9 @@ class CommitsController < ApplicationController
send_data(
@commit.to_patch,
:type => "text/plain",
:disposition => 'attachment',
:filename => (@commit.id.to_s + ".patch")
type: "text/plain",
disposition: 'attachment',
filename: (@commit.id.to_s + ".patch")
)
end
end
......@@ -9,7 +9,7 @@ class DashboardController < ApplicationController
respond_to do |format|
format.html
format.js
format.atom { render :layout => false }
format.atom { render layout: false }
end
end
......@@ -28,7 +28,7 @@ class DashboardController < ApplicationController
respond_to do |format|
format.html
format.atom { render :layout => false }
format.atom { render layout: false }
end
end
end
......@@ -40,7 +40,7 @@ class DeployKeysController < ApplicationController
respond_to do |format|
format.html { redirect_to project_deploy_keys_url }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
end
......@@ -6,7 +6,7 @@ class HooksController < ApplicationController
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
before_filter :authorize_admin_project!, :only => [:new, :create, :destroy]
before_filter :authorize_admin_project!, only: [:new, :create, :destroy]
respond_to :html
......
......@@ -2,7 +2,7 @@ class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :issue, :only => [:edit, :update, :destroy, :show]
before_filter :issue, only: [:edit, :update, :destroy, :show]
helper_method :issues_filter
layout "project"
......@@ -14,13 +14,13 @@ class IssuesController < ApplicationController
before_filter :authorize_read_issue!
# Allow write(create) issue
before_filter :authorize_write_issue!, :only => [:new, :create]
before_filter :authorize_write_issue!, only: [:new, :create]
# Allow modify issue
before_filter :authorize_modify_issue!, :only => [:close, :edit, :update]
before_filter :authorize_modify_issue!, only: [:close, :edit, :update]
# Allow destroy issue
before_filter :authorize_admin_issue!, :only => [:destroy]
before_filter :authorize_admin_issue!, only: [:destroy]
respond_to :js, :html
......@@ -32,7 +32,7 @@ class IssuesController < ApplicationController
respond_to do |format|
format.html # index.html.erb
format.js
format.atom { render :layout => false }
format.atom { render layout: false }
end
end
......@@ -46,7 +46,7 @@ class IssuesController < ApplicationController
end
def show
@note = @project.notes.new(:noteable => @issue)
@note = @project.notes.new(noteable: @issue)
respond_to do |format|
format.html
......@@ -66,7 +66,7 @@ class IssuesController < ApplicationController
end
def update
@issue.update_attributes(params[:issue].merge(:author_id_of_changes => current_user.id))
@issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
respond_to do |format|
format.js
......@@ -87,20 +87,20 @@ class IssuesController < ApplicationController
respond_to do |format|
format.html { redirect_to project_issues_path }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
def sort
return render_404 unless can?(current_user, :admin_issue, @project)
@issues = @project.issues.where(:id => params['issue'])
@issues = @project.issues.where(id: params['issue'])
@issues.each do |issue|
issue.position = params['issue'].index(issue.id.to_s) + 1
issue.save
end
render :nothing => true
render nothing: true
end
def search
......@@ -110,12 +110,12 @@ class IssuesController < ApplicationController
@issues = @issues.where("title LIKE ?", "%#{terms}%") unless terms.blank?
@issues = @issues.page(params[:page]).per(100)
render :partial => 'issues'
render partial: 'issues'
end
def bulk_update
result = IssuesBulkUpdateContext.new(project, current_user, params).execute
redirect_to :back, :notice => "#{result[:count]} issues updated"
redirect_to :back, notice: "#{result[:count]} issues updated"
end
protected
......@@ -144,8 +144,8 @@ class IssuesController < ApplicationController
else @project.issues.opened
end
@issues = @issues.where(:assignee_id => params[:assignee_id]) if params[:assignee_id].present?
@issues = @issues.where(:milestone_id => params[:milestone_id]) if params[:milestone_id].present?
@issues = @issues.where(assignee_id: params[:assignee_id]) if params[:assignee_id].present?
@issues = @issues.where(milestone_id: params[:milestone_id]) if params[:milestone_id].present?
@issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
@issues = @issues.includes(:author, :project).order("updated_at")
@issues
......
......@@ -29,7 +29,7 @@ class KeysController < ApplicationController
respond_to do |format|
format.html { redirect_to keys_url }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
end
......@@ -2,9 +2,9 @@ class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
before_filter :validates_merge_request, :only => [:show, :diffs, :raw]
before_filter :define_show_vars, :only => [:show, :diffs]
before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
before_filter :validates_merge_request, only: [:show, :diffs, :raw]
before_filter :define_show_vars, only: [:show, :diffs]
layout "project"
# Authorize
......@@ -14,13 +14,13 @@ class MergeRequestsController < ApplicationController
before_filter :authorize_read_merge_request!
# Allow write(create) merge_request
before_filter :authorize_write_merge_request!, :only => [:new, :create]
before_filter :authorize_write_merge_request!, only: [:new, :create]
# Allow modify merge_request
before_filter :authorize_modify_merge_request!, :only => [:close, :edit, :update, :sort]
before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort]
# Allow destroy merge_request
before_filter :authorize_admin_merge_request!, :only => [:destroy]
before_filter :authorize_admin_merge_request!, only: [:destroy]
def index
......@@ -66,7 +66,7 @@ class MergeRequestsController < ApplicationController
end
def update
if @merge_request.update_attributes(params[:merge_request].merge(:author_id_of_changes => current_user.id))
if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
@merge_request.reload_code
@merge_request.mark_as_unchecked
redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.'
......@@ -79,7 +79,7 @@ class MergeRequestsController < ApplicationController
if @merge_request.unchecked?
@merge_request.check_if_can_be_merged
end
render :json => {:state => @merge_request.human_state}
render json: {state: @merge_request.human_state}
end
def automerge
......@@ -138,7 +138,7 @@ class MergeRequestsController < ApplicationController
def define_show_vars
# Build a note object for comment form
@note = @project.notes.new(:noteable => @merge_request)
@note = @project.notes.new(noteable: @merge_request)
# Get commits from repository
# or from cache if already merged
......
......@@ -2,7 +2,7 @@ class MilestonesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :milestone, :only => [:edit, :update, :destroy, :show]
before_filter :milestone, only: [:edit, :update, :destroy, :show]
layout "project"
# Authorize
......@@ -12,7 +12,7 @@ class MilestonesController < ApplicationController
before_filter :authorize_read_milestone!
# Allow admin milestone
before_filter :authorize_admin_milestone!, :except => [:index, :show]
before_filter :authorize_admin_milestone!, except: [:index, :show]
respond_to :html
......@@ -77,7 +77,7 @@ class MilestonesController < ApplicationController
respond_to do |format|
format.html { redirect_to project_milestones_path }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
......
......@@ -5,7 +5,7 @@ class NotesController < ApplicationController
before_filter :add_project_abilities
before_filter :authorize_read_note!
before_filter :authorize_write_note!, :only => [:create]
before_filter :authorize_write_note!, only: [:create]
respond_to :js
......@@ -29,12 +29,12 @@ class NotesController < ApplicationController
@note.destroy
respond_to do |format|
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
def preview
render :text => view_context.markdown(params[:note])
render text: view_context.markdown(params[:note])
end
protected
......
......@@ -26,7 +26,7 @@ class ProfileController < ApplicationController
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else
render :action => "password"
render action: "password"
end
end
......
require File.join(Rails.root, 'lib', 'graph_commit')
class ProjectsController < ApplicationController
before_filter :project, :except => [:index, :new, :create]
before_filter :project, except: [:index, :new, :create]
layout :determine_layout
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree, :graph]
before_filter :authorize_read_project!, except: [:index, :new, :create]
before_filter :authorize_admin_project!, only: [:edit, :update, :destroy]
before_filter :require_non_empty_project, only: [:blob, :tree, :graph]
def new
@project = Project.new
......@@ -35,7 +35,7 @@ class ProjectsController < ApplicationController
def update
respond_to do |format|
if project.update_attributes(params[:project])
format.html { redirect_to edit_project_path(project), :notice => 'Project was successfully updated.' }
format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
format.js
else
format.html { render action: "edit" }
......
......@@ -6,7 +6,7 @@ class ProtectedBranchesController < ApplicationController
before_filter :authorize_read_project!
before_filter :require_non_empty_project
before_filter :authorize_admin_project!, :only => [:destroy, :create]
before_filter :authorize_admin_project!, only: [:destroy, :create]
before_filter :render_full_content
layout "project"
......@@ -26,7 +26,7 @@ class ProtectedBranchesController < ApplicationController
respond_to do |format|
format.html { redirect_to project_protected_branches_path }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
end
......@@ -9,7 +9,7 @@ class RefsController < ApplicationController
before_filter :require_non_empty_project
before_filter :ref
before_filter :define_tree_vars, :only => [:tree, :blob, :blame, :logs_tree]
before_filter :define_tree_vars, only: [:tree, :blob, :blame, :logs_tree]
before_filter :render_full_content
layout "project"
......@@ -20,7 +20,7 @@ class RefsController < ApplicationController
new_path = if params[:destination] == "tree"
tree_project_ref_path(@project, params[:ref])
else
project_commits_path(@project, :ref => params[:ref])
project_commits_path(@project, ref: params[:ref])
end
redirect_to new_path
......@@ -53,8 +53,8 @@ class RefsController < ApplicationController
last_commit = @project.commits(@commit.id, file, 1).last
last_commit = CommitDecorator.decorate(last_commit)
{
:file_name => content.name,
:commit => last_commit
file_name: content.name,
commit: last_commit
}
end
end
......@@ -70,9 +70,9 @@ class RefsController < ApplicationController
send_data(
@tree.data,
:type => mime_type,
:disposition => 'inline',
:filename => @tree.name
type: mime_type,
disposition: 'inline',
filename: @tree.name
)
else
head(404)
......
......@@ -8,8 +8,8 @@ class SearchController < ApplicationController
if query.present?
@projects = current_user.projects.search(query).limit(10)
@merge_requests = MergeRequest.where(:project_id => current_user.project_ids).search(query).limit(10)
@issues = Issue.where(:project_id => current_user.project_ids).search(query).limit(10)
@merge_requests = MergeRequest.where(project_id: current_user.project_ids).search(query).limit(10)
@issues = Issue.where(project_id: current_user.project_ids).search(query).limit(10)
end
end
end
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :snippet, :only => [:show, :edit, :destroy, :update, :raw]
before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]
layout "project"
# Authorize
......@@ -11,13 +11,13 @@ class SnippetsController < ApplicationController
before_filter :authorize_read_snippet!
# Allow write(create) snippet
before_filter :authorize_write_snippet!, :only => [:new, :create]
before_filter :authorize_write_snippet!, only: [:new, :create]
# Allow modify snippet
before_filter :authorize_modify_snippet!, :only => [:edit, :update]
before_filter :authorize_modify_snippet!, only: [:edit, :update]
# Allow destroy snippet
before_filter :authorize_admin_snippet!, :only => [:destroy]
before_filter :authorize_admin_snippet!, only: [:destroy]
respond_to :html
......@@ -55,7 +55,7 @@ class SnippetsController < ApplicationController
end
def show
@note = @project.notes.new(:noteable => @snippet)
@note = @project.notes.new(noteable: @snippet)
render_full_content
end
......@@ -70,9 +70,9 @@ class SnippetsController < ApplicationController
def raw
send_data(
@snippet.content,
:type => "text/plain",
:disposition => 'inline',
:filename => @snippet.file_name
type: "text/plain",
disposition: 'inline',
filename: @snippet.file_name
)
end
......
......@@ -5,7 +5,7 @@ class TeamMembersController < ApplicationController
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
before_filter :authorize_admin_project!, :except => [:show]
before_filter :authorize_admin_project!, except: [:show]
def show
@team_member = project.users_projects.find(params[:id])
......@@ -41,7 +41,7 @@ class TeamMembersController < ApplicationController
respond_to do |format|
format.html { redirect_to team_project_path(@project) }
format.js { render :nothing => true }
format.js { render nothing: true }
end
end
end
......@@ -2,8 +2,8 @@ class WikisController < ApplicationController
before_filter :project
before_filter :add_project_abilities
before_filter :authorize_read_wiki!
before_filter :authorize_write_wiki!, :only => [:edit, :create, :history]
before_filter :authorize_admin_wiki!, :only => :destroy
before_filter :authorize_write_wiki!, only: [:edit, :create, :history]
before_filter :authorize_admin_wiki!, only: :destroy
layout "project"
def pages
......@@ -14,16 +14,16 @@ class WikisController < ApplicationController
if params[:old_page_id]
@wiki = @project.wikis.find(params[:old_page_id])
else
@wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last
@wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
end
@note = @project.notes.new(:noteable => @wiki)
@note = @project.notes.new(noteable: @wiki)
if @wiki
render 'show'
else
if can?(current_user, :write_wiki, @project)
@wiki = @project.wikis.new(:slug => params[:id])
@wiki = @project.wikis.new(slug: params[:id])
render 'edit'
else
render 'empty'
......@@ -32,7 +32,7 @@ class WikisController < ApplicationController
end
def edit
@wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last
@wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
@wiki = Wiki.regenerate_from @wiki
end
......@@ -50,11 +50,11 @@ class WikisController < ApplicationController
end
def history
@wikis = @project.wikis.where(:slug => params[:id]).order("created_at")
@wikis = @project.wikis.where(slug: params[:id]).order("created_at")
end
def destroy
@wikis = @project.wikis.where(:slug => params[:id]).delete_all
@wikis = @project.wikis.where(slug: params[:id]).delete_all
respond_to do |format|
format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
......
......@@ -15,7 +15,7 @@ class ApplicationDecorator < Drapper::Base
#
# def formatted_timestamp(time)
# h.content_tag :span, time.strftime("%a %m/%d/%y"),
# :class => 'timestamp'
# class: 'timestamp'
# end
#
# def created_at
......
......@@ -19,7 +19,7 @@ class EventDecorator < ApplicationDecorator
elsif self.merge_request?
h.project_merge_request_url(self.project, self.merge_request)
elsif self.push?
h.project_commits_url(self.project, :ref => self.ref_name)
h.project_commits_url(self.project, ref: self.ref_name)
end
end
end
......@@ -8,14 +8,14 @@ class TreeDecorator < ApplicationDecorator
#parts = parts[0...-1] if is_blob?
yield(h.link_to("..", "#", :remote => :true)) if parts.count > max_links
yield(h.link_to("..", "#", remote: :true)) if parts.count > max_links
parts.each do |part|
part_path = File.join(part_path, part) unless part_path.empty?
part_path = part if part_path.empty?
next unless parts.last(2).include?(part) if parts.count > max_links
yield(h.link_to(h.truncate(part, :length => 40), h.tree_file_project_ref_path(project, ref, :path => part_path), :remote => :true))
yield(h.link_to(h.truncate(part, length: 40), h.tree_file_project_ref_path(project, ref, path: part_path), remote: :true))
end
end
end
......@@ -30,7 +30,7 @@ class TreeDecorator < ApplicationDecorator
end
def history_path
h.project_commits_path(project, :path => path, :ref => ref)
h.project_commits_path(project, path: path, ref: ref)
end
def mb_size
......
......@@ -43,23 +43,23 @@ module ApplicationHelper
end
def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
projects = current_user.projects.map{ |p| { label: p.name, url: project_path(p) } }
default_nav = [
{ :label => "Profile", :url => profile_path },
{ :label => "Keys", :url => keys_path },
{ :label => "Dashboard", :url => root_path },
{ :label => "Admin", :url => admin_root_path }
{ label: "Profile", url: profile_path },
{ label: "Keys", url: keys_path },
{ label: "Dashboard", url: root_path },
{ label: "Admin", url: admin_root_path }
]
project_nav = []
if @project && !@project.new_record?
project_nav = [
{ :label => "#{@project.name} / Issues", :url => project_issues_path(@project) },
{ :label => "#{@project.name} / Wall", :url => wall_project_path(@project) },
{ :label => "#{@project.name} / Tree", :url => tree_project_ref_path(@project, @project.root_ref) },
{ :label => "#{@project.name} / Commits", :url => project_commits_path(@project) },
{ :label => "#{@project.name} / Team", :url => team_project_path(@project) }
{ label: "#{@project.name} / Issues", url: project_issues_path(@project) },
{ label: "#{@project.name} / Wall", url: wall_project_path(@project) },
{ label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) },
{ label: "#{@project.name} / Commits", url: project_commits_path(@project) },
{ label: "#{@project.name} / Team", url: team_project_path(@project) }
]
end
......@@ -89,7 +89,7 @@ module ApplicationHelper
when :wall; wall_tab?
when :wiki; controller.controller_name == "wikis"
when :issues; issues_tab?
when :network; current_page?(:controller => "projects", :action => "graph", :id => @project)
when :network; current_page?(controller: "projects", action: "graph", id: @project)
when :merge_requests; controller.controller_name == "merge_requests"
# Dashboard Area
......@@ -100,10 +100,10 @@ module ApplicationHelper
when :root; current_page?(dashboard_path) || current_page?(root_path)
# Profile Area
when :profile; current_page?(:controller => "profile", :action => :show)
when :password; current_page?(:controller => "profile", :action => :password)
when :token; current_page?(:controller => "profile", :action => :token)
when :design; current_page?(:controller => "profile", :action => :design)
when :profile; current_page?(controller: "profile", action: :show)
when :password; current_page?(controller: "profile", action: :password)
when :token; current_page?(controller: "profile", action: :token)
when :design; current_page?(controller: "profile", action: :design)
when :ssh_keys; controller.controller_name == "keys"
# Admin Area
......
......@@ -28,32 +28,32 @@ module GitlabMarkdownHelper
# team member: @foo
when /^@/
user = @project.users.where(:name => user_name).first
member = @project.users_projects.where(:user_id => user).first if user
link_to("@#{user_name}", project_team_member_path(@project, member), html_options.merge(:class => "gfm gfm-team_member #{html_options[:class]}")) if member
user = @project.users.where(name: user_name).first
member = @project.users_projects.where(user_id: user).first if user
link_to("@#{user_name}", project_team_member_path(@project, member), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member
# issue: #123
when /^#/
# avoid HTML entities
unless prefix.try(:end_with?, "&") && suffix.try(:start_with?, ";")
issue = @project.issues.where(:id => issue_id).first
link_to("##{issue_id}", project_issue_path(@project, issue), html_options.merge(:title => "Issue: #{issue.title}", :class => "gfm gfm-issue #{html_options[:class]}")) if issue
issue = @project.issues.where(id: issue_id).first
link_to("##{issue_id}", project_issue_path(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}")) if issue
end
# merge request: !123
when /^!/
merge_request = @project.merge_requests.where(:id => merge_request_id).first
link_to("!#{merge_request_id}", project_merge_request_path(@project, merge_request), html_options.merge(:title => "Merge Request: #{merge_request.title}", :class => "gfm gfm-merge_request #{html_options[:class]}")) if merge_request
merge_request = @project.merge_requests.where(id: merge_request_id).first
link_to("!#{merge_request_id}", project_merge_request_path(@project, merge_request), html_options.merge(title: "Merge Request: #{merge_request.title}", class: "gfm gfm-merge_request #{html_options[:class]}")) if merge_request
# snippet: $123
when /^\$/
snippet = @project.snippets.where(:id => snippet_id).first
link_to("$#{snippet_id}", project_snippet_path(@project, snippet), html_options.merge(:title => "Snippet: #{snippet.title}", :class => "gfm gfm-snippet #{html_options[:class]}")) if snippet
snippet = @project.snippets.where(id: snippet_id).first
link_to("$#{snippet_id}", project_snippet_path(@project, snippet), html_options.merge(title: "Snippet: #{snippet.title}", class: "gfm gfm-snippet #{html_options[:class]}")) if snippet
# commit: 123456...
when /^\h/
commit = @project.commit(commit_id)
link_to(commit_id, project_commit_path(@project, :id => commit.id), html_options.merge(:title => "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", :class => "gfm gfm-commit #{html_options[:class]}")) if commit
link_to(commit_id, project_commit_path(@project, id: commit.id), html_options.merge(title: "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", class: "gfm gfm-commit #{html_options[:class]}")) if commit
end # case
......
......@@ -9,7 +9,7 @@ module IssuesHelper
tm = project.team_member_by_id(issue.assignee_id)
if tm
link_to issue.assignee_name, project_team_member_path(project, tm), :class => "author_link"
link_to issue.assignee_name, project_team_member_path(project, tm), class: "author_link"
else
issue.assignee_name
end
......@@ -20,7 +20,7 @@ module IssuesHelper
tm = project.team_member_by_id(issue.author_id)
if tm
link_to issue.author_name, project_team_member_path(project, tm), :class => "author_link"
link_to issue.author_name, project_team_member_path(project, tm), class: "author_link"
else
issue.author_name
end
......
......@@ -4,7 +4,7 @@ module MergeRequestsHelper
tm = project.team_member_by_id(merge_request.assignee_id)
if tm
link_to merge_request.assignee_name, project_team_member_path(project, tm), :class => "author_link"
link_to merge_request.assignee_name, project_team_member_path(project, tm), class: "author_link"
else
merge_request.assignee_name
end
......@@ -15,7 +15,7 @@ module MergeRequestsHelper
tm = project.team_member_by_id(merge_request.author_id)
if tm
link_to merge_request.author_name, project_team_member_path(project, tm), :class => "author_link"
link_to merge_request.author_name, project_team_member_path(project, tm), class: "author_link"
else
merge_request.author_name
end
......@@ -24,10 +24,10 @@ module MergeRequestsHelper
def new_mr_path_from_push_event(event)
new_project_merge_request_path(
event.project,
:merge_request => {
:source_branch => event.branch_name,
:target_branch => event.project.root_ref,
:title => event.branch_name.titleize
merge_request: {
source_branch: event.branch_name,
target_branch: event.project.root_ref,
title: event.branch_name.titleize
}
)
end
......
......@@ -4,12 +4,12 @@ module TabHelper
end
def wall_tab?
current_page?(:controller => "projects", :action => "wall", :id => @project)
current_page?(controller: "projects", action: "wall", id: @project)
end
def project_tab_class
[:show, :files, :team, :edit, :update].each do |action|
return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
return "current" if current_page?(controller: "projects", action: action, id: @project)
end
if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
......
......@@ -12,20 +12,20 @@ class Notify < ActionMailer::Base
def new_user_email(user_id, password)
@user = User.find(user_id)
@password = password
mail(:to => @user.email, :subject => "gitlab | Account was created for you")
mail(to: @user.email, subject: "gitlab | Account was created for you")
end
def new_issue_email(issue_id)
@issue = Issue.find(issue_id)
@project = @issue.project
mail(:to => @issue.assignee_email, :subject => "gitlab | new issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
mail(to: @issue.assignee_email, subject: "gitlab | new issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
end
def note_wall_email(recipient_id, note_id)
recipient = User.find(recipient_id)
@note = Note.find(note_id)
@project = @note.project
mail(:to => recipient.email, :subject => "gitlab | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | #{@project.name}")
end
def note_commit_email(recipient_id, note_id)
......@@ -34,7 +34,7 @@ class Notify < ActionMailer::Base
@commit = @note.target
@commit = CommitDecorator.decorate(@commit)
@project = @note.project
mail(:to => recipient.email, :subject => "gitlab | note for commit #{@commit.short_id} | #{@commit.title} | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | note for commit #{@commit.short_id} | #{@commit.title} | #{@project.name}")
end
def note_merge_request_email(recipient_id, note_id)
......@@ -42,7 +42,7 @@ class Notify < ActionMailer::Base
@note = Note.find(note_id)
@merge_request = @note.noteable
@project = @note.project
mail(:to => recipient.email, :subject => "gitlab | note for merge request !#{@merge_request.id} | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | note for merge request !#{@merge_request.id} | #{@project.name}")
end
def note_issue_email(recipient_id, note_id)
......@@ -50,7 +50,7 @@ class Notify < ActionMailer::Base
@note = Note.find(note_id)
@issue = @note.noteable
@project = @note.project
mail(:to => recipient.email, :subject => "gitlab | note for issue ##{@issue.id} | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | note for issue ##{@issue.id} | #{@project.name}")
end
def note_wiki_email(recipient_id, note_id)
......@@ -58,13 +58,13 @@ class Notify < ActionMailer::Base
@note = Note.find(note_id)
@wiki = @note.noteable
@project = @note.project
mail(:to => recipient.email, :subject => "gitlab | note for wiki | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | note for wiki | #{@project.name}")
end
def new_merge_request_email(merge_request_id)
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
mail(to: @merge_request.assignee_email, subject: "gitlab | new merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
end
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
......@@ -72,7 +72,7 @@ class Notify < ActionMailer::Base
@merge_request = MergeRequest.find(merge_request_id)
@previous_assignee ||= User.find(previous_assignee_id)
@project = @merge_request.project
mail(:to => recipient.email, :subject => "gitlab | changed merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | changed merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
end
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
......@@ -80,6 +80,6 @@ class Notify < ActionMailer::Base
@issue = Issue.find(issue_id)
@previous_assignee ||= User.find(previous_assignee_id)
@project = @issue.project
mail(:to => recipient.email, :subject => "gitlab | changed issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
mail(to: recipient.email, subject: "gitlab | changed issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
end
end
......@@ -20,7 +20,7 @@ class Commit
:tree,
:id,
:to_patch,
:to => :commit
to: :commit
class << self
......@@ -57,7 +57,7 @@ class Commit
def commits_since(repo, date)
commits = repo.heads.map do |h|
repo.log(h.name, nil, :since => date).each { |c| Commit.new(c, h) }
repo.log(h.name, nil, since: date).each { |c| Commit.new(c, h) }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
......@@ -69,7 +69,7 @@ class Commit
def commits(repo, ref, path = nil, limit = nil, offset = nil)
if path
repo.log(ref, path, :max_count => limit, :skip => offset)
repo.log(ref, path, max_count: limit, skip: offset)
elsif limit && offset
repo.commits(ref, limit, offset)
else
......@@ -86,9 +86,9 @@ class Commit
last = project.commit(from.try(:strip))
result = {
:commits => [],
:diffs => [],
:commit => nil
commits: [],
diffs: [],
commit: nil
}
if first && last
......
......@@ -12,13 +12,13 @@ class Event < ActiveRecord::Base
Merged = 7
belongs_to :project
belongs_to :target, :polymorphic => true
belongs_to :target, polymorphic: true
# For Hash only
serialize :data
scope :recent, order("created_at DESC")
scope :code_push, where(:action => Pushed)
scope :code_push, where(action: Pushed)
def self.determine_action(record)
if [Issue, MergeRequest].include? record.class
......@@ -29,7 +29,7 @@ class Event < ActiveRecord::Base
end
def self.recent_for_user user
where(:project_id => user.projects.map(&:id)).recent
where(project_id: user.projects.map(&:id)).recent
end
# Next events currently enabled for system
......@@ -106,9 +106,9 @@ class Event < ActiveRecord::Base
end
end
delegate :name, :email, :to => :author, :prefix => true, :allow_nil => true
delegate :title, :to => :issue, :prefix => true, :allow_nil => true
delegate :title, :to => :merge_request, :prefix => true, :allow_nil => true
delegate :name, :email, to: :author, prefix: true, allow_nil: true
delegate :title, to: :issue, prefix: true, allow_nil: true
delegate :title, to: :merge_request, prefix: true, allow_nil: true
end
# == Schema Information
#
......
......@@ -7,7 +7,7 @@ class Issue < ActiveRecord::Base
belongs_to :milestone
validates :description,
:length => { :within => 0..2000 }
length: { within: 0..2000 }
acts_as_list
......
......@@ -6,16 +6,16 @@ class Key < ActiveRecord::Base
belongs_to :project
validates :title,
:presence => true,
:length => { :within => 0..255 }
presence: true,
length: { within: 0..255 }
validates :key,
:presence => true,
:length => { :within => 0..5000 }
presence: true,
length: { within: 0..5000 }
before_save :set_identifier
before_validation :strip_white_space
delegate :name, :email, :to => :user, :prefix => true
delegate :name, :email, to: :user, prefix: true
validate :unique_key
def strip_white_space
......@@ -23,7 +23,7 @@ class Key < ActiveRecord::Base
end
def unique_key
query = Key.where(:key => key)
query = Key.where(key: key)
query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
if (query.count > 0)
errors.add :key, 'already exist.'
......
......@@ -20,7 +20,7 @@ class MergeRequest < ActiveRecord::Base
validate :validate_branches
def self.find_all_by_branch(branch_name)
where("source_branch like :branch or target_branch like :branch", :branch => branch_name)
where("source_branch like :branch or target_branch like :branch", branch: branch_name)
end
def human_state
......@@ -48,7 +48,7 @@ class MergeRequest < ActiveRecord::Base
end
def mark_as_unchecked
self.update_attributes(:state => UNCHECKED)
self.update_attributes(state: UNCHECKED)
end
def can_be_merged?
......@@ -101,11 +101,11 @@ class MergeRequest < ActiveRecord::Base
end
def merge_event
self.project.events.where(:target_id => self.id, :target_type => "MergeRequest", :action => Event::Merged).last
self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last
end
def closed_event
self.project.events.where(:target_id => self.id, :target_type => "MergeRequest", :action => Event::Closed).last
self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last
end
def commits
......@@ -128,7 +128,7 @@ class MergeRequest < ActiveRecord::Base
end
def mark_as_unmergable
self.update_attributes :state => CANNOT_BE_MERGED
self.update_attributes state: CANNOT_BE_MERGED
end
def reloaded_commits
......@@ -150,11 +150,11 @@ class MergeRequest < ActiveRecord::Base
def merge!(user_id)
self.mark_as_merged!
Event.create(
:project => self.project,
:action => Event::Merged,
:target_id => self.id,
:target_type => "MergeRequest",
:author_id => user_id
project: self.project,
action: Event::Merged,
target_id: self.id,
target_type: "MergeRequest",
author_id: user_id
)
end
......
......@@ -24,7 +24,7 @@ class Milestone < ActiveRecord::Base
end
def participants
User.where(:id => issues.map(&:assignee_id))
User.where(id: issues.map(&:assignee_id))
end
def percent_complete
......
......@@ -3,18 +3,18 @@ require 'file_size_validator'
class Note < ActiveRecord::Base
belongs_to :project
belongs_to :noteable, :polymorphic => true
belongs_to :noteable, polymorphic: true
belongs_to :author,
:class_name => "User"
class_name: "User"
delegate :name,
:to => :project,
:prefix => true
to: :project,
prefix: true
delegate :name,
:email,
:to => :author,
:prefix => true
to: :author,
prefix: true
attr_protected :author, :author_id
attr_accessor :notify
......@@ -23,19 +23,19 @@ class Note < ActiveRecord::Base
validates_presence_of :project
validates :note,
:presence => true,
:length => { :within => 0..5000 }
presence: true,
length: { within: 0..5000 }
validates :attachment,
:file_size => {
:maximum => 10.megabytes.to_i
file_size: {
maximum: 10.megabytes.to_i
}
scope :common, where(:noteable_id => nil)
scope :common, where(noteable_id: nil)
scope :today, where("created_at >= :date", :date => Date.today)
scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days))
scope :since, lambda { |day| where("created_at >= :date", :date => (day)) }
scope :today, where("created_at >= :date", date: Date.today)
scope :last_week, where("created_at >= :date", date: (Date.today - 7.days))
scope :since, lambda { |day| where("created_at >= :date", date: (day)) }
scope :fresh, order("created_at DESC")
scope :inc_author_project, includes(:project, :author)
scope :inc_author, includes(:author)
......@@ -43,11 +43,11 @@ class Note < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
def self.create_status_change_note(noteable, author, status)
create({ :noteable => noteable,
:project => noteable.project,
:author => author,
:note => "_Status changed to #{status}_" },
:without_protection => true)
create({ noteable: noteable,
project: noteable.project,
author: author,
note: "_Status changed to #{status}_" },
without_protection: true)
end
def notify
......
......@@ -9,19 +9,19 @@ class Project < ActiveRecord::Base
#
# Relations
#
belongs_to :owner, :class_name => "User"
has_many :users, :through => :users_projects
has_many :events, :dependent => :destroy
has_many :merge_requests, :dependent => :destroy
has_many :issues, :dependent => :destroy, :order => "closed, created_at DESC"
has_many :milestones, :dependent => :destroy
has_many :users_projects, :dependent => :destroy
has_many :notes, :dependent => :destroy
has_many :snippets, :dependent => :destroy
has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key"
has_many :hooks, :dependent => :destroy, :class_name => "ProjectHook"
has_many :wikis, :dependent => :destroy
has_many :protected_branches, :dependent => :destroy
belongs_to :owner, class_name: "User"
has_many :users, through: :users_projects
has_many :events, dependent: :destroy
has_many :merge_requests, dependent: :destroy
has_many :issues, dependent: :destroy, order: "closed, created_at DESC"
has_many :milestones, dependent: :destroy
has_many :users_projects, dependent: :destroy
has_many :notes, dependent: :destroy
has_many :snippets, dependent: :destroy
has_many :deploy_keys, dependent: :destroy, foreign_key: "project_id", class_name: "Key"
has_many :hooks, dependent: :destroy, class_name: "ProjectHook"
has_many :wikis, dependent: :destroy
has_many :protected_branches, dependent: :destroy
attr_accessor :error_code
......@@ -33,15 +33,15 @@ class Project < ActiveRecord::Base
#
# Scopes
#
scope :public_only, where(:private_flag => false)
scope :without_user, lambda { |user| where("id not in (:ids)", :ids => user.projects.map(&:id) ) }
scope :public_only, where(private_flag: false)
scope :without_user, lambda { |user| where("id not in (:ids)", ids: user.projects.map(&:id) ) }
def self.active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
end
def self.search query
where("name like :query or code like :query or path like :query", :query => "%#{query}%")
where("name like :query or code like :query or path like :query", query: "%#{query}%")
end
def self.create_by_user(params, user)
......@@ -53,7 +53,7 @@ class Project < ActiveRecord::Base
project.save!
# Add user as project master
project.users_projects.create!(:project_access => UsersProject::MASTER, :user => user)
project.users_projects.create!(project_access: UsersProject::MASTER, user: user)
# when project saved no team member exist so
# project repository should be updated after first user add
......@@ -82,28 +82,28 @@ class Project < ActiveRecord::Base
# Validations
#
validates :name,
:uniqueness => true,
:presence => true,
:length => { :within => 0..255 }
uniqueness: true,
presence: true,
length: { within: 0..255 }
validates :path,
:uniqueness => true,
:presence => true,
:format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
:message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
:length => { :within => 0..255 }
uniqueness: true,
presence: true,
format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
length: { within: 0..255 }
validates :description,
:length => { :within => 0..2000 }
length: { within: 0..2000 }
validates :code,
:presence => true,
:uniqueness => true,
:format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
:message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
:length => { :within => 1..255 }
presence: true,
uniqueness: true,
format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
length: { within: 1..255 }
validates :owner, :presence => true
validates :owner, presence: true
validate :check_limit
validate :repo_name
......@@ -134,19 +134,19 @@ class Project < ActiveRecord::Base
end
def common_notes
notes.where(:noteable_type => ["", nil]).inc_author_project
notes.where(noteable_type: ["", nil]).inc_author_project
end
def build_commit_note(commit)
notes.new(:noteable_id => commit.id, :noteable_type => "Commit")
notes.new(noteable_id: commit.id, noteable_type: "Commit")
end
def commit_notes(commit)
notes.where(:noteable_id => commit.id, :noteable_type => "Commit", :line_code => nil)
notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
end
def commit_line_notes(commit)
notes.where(:noteable_id => commit.id, :noteable_type => "Commit").where("line_code is not null")
notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code is not null")
end
def public?
......
......@@ -2,29 +2,29 @@ class Snippet < ActiveRecord::Base
include Linguist::BlobHelper
belongs_to :project
belongs_to :author, :class_name => "User"
has_many :notes, :as => :noteable, :dependent => :destroy
belongs_to :author, class_name: "User"
has_many :notes, as: :noteable, dependent: :destroy
delegate :name,
:email,
:to => :author,
:prefix => true
to: :author,
prefix: true
attr_protected :author, :author_id, :project, :project_id
validates_presence_of :project_id
validates_presence_of :author_id
validates :title,
:presence => true,
:length => { :within => 0..255 }
presence: true,
length: { within: 0..255 }
validates :file_name,
:presence => true,
:length => { :within => 0..255 }
presence: true,
length: { within: 0..255 }
validates :content,
:presence => true,
:length => { :within => 0..10000 }
presence: true,
length: { within: 0..10000 }
scope :fresh, order("created_at DESC")
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
......
......@@ -11,7 +11,7 @@ class Tree
:size,
:text?,
:colorize,
:to => :tree
to: :tree
def initialize(raw_tree, project, ref = nil, path = nil)
@project, @ref, @path = project, ref, path,
......
......@@ -11,58 +11,58 @@ class User < ActiveRecord::Base
attr_accessor :force_random_password
has_many :users_projects, :dependent => :destroy
has_many :projects, :through => :users_projects
has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id
has_many :keys, :dependent => :destroy
has_many :users_projects, dependent: :destroy
has_many :projects, through: :users_projects
has_many :my_own_projects, class_name: "Project", foreign_key: :owner_id
has_many :keys, dependent: :destroy
has_many :events,
:class_name => "Event",
:foreign_key => :author_id,
:dependent => :destroy
class_name: "Event",
foreign_key: :author_id,
dependent: :destroy
has_many :recent_events,
:class_name => "Event",
:foreign_key => :author_id,
:order => "id DESC"
class_name: "Event",
foreign_key: :author_id,
order: "id DESC"
has_many :issues,
:foreign_key => :author_id,
:dependent => :destroy
foreign_key: :author_id,
dependent: :destroy
has_many :notes,
:foreign_key => :author_id,
:dependent => :destroy
foreign_key: :author_id,
dependent: :destroy
has_many :assigned_issues,
:class_name => "Issue",
:foreign_key => :assignee_id,
:dependent => :destroy
class_name: "Issue",
foreign_key: :assignee_id,
dependent: :destroy
has_many :merge_requests,
:foreign_key => :author_id,
:dependent => :destroy
foreign_key: :author_id,
dependent: :destroy
has_many :assigned_merge_requests,
:class_name => "MergeRequest",
:foreign_key => :assignee_id,
:dependent => :destroy
class_name: "MergeRequest",
foreign_key: :assignee_id,
dependent: :destroy
validates :projects_limit,
:presence => true,
:numericality => {:greater_than_or_equal_to => 0}
presence: true,
numericality: {greater_than_or_equal_to: 0}
validates :bio, :length => { :within => 0..255 }
validates :bio, length: { within: 0..255 }
before_save :ensure_authentication_token
alias_attribute :private_token, :authentication_token
scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
scope :admins, where(:admin => true)
scope :blocked, where(:blocked => true)
scope :active, where(:blocked => false)
scope :not_in_project, lambda { |project| where("id not in (:ids)", ids: project.users.map(&:id) ) }
scope :admins, where(admin: true)
scope :blocked, where(blocked: true)
scope :active, where(blocked: false)
before_validation :generate_password, :on => :create
before_validation :generate_password, on: :create
def generate_password
if self.force_random_password
......@@ -94,17 +94,17 @@ class User < ActiveRecord::Base
else
password = Devise.friendly_token[0, 8].downcase
@user = User.create(
:name => name,
:email => email,
:password => password,
:password_confirmation => password,
:projects_limit => Gitlab.config.default_projects_limit
name: name,
email: email,
password: password,
password_confirmation: password,
projects_limit: Gitlab.config.default_projects_limit
)
end
end
def self.search query
where("name like :query or email like :query", :query => "%#{query}%")
where("name like :query or email like :query", query: "%#{query}%")
end
end
# == Schema Information
......
......@@ -12,18 +12,18 @@ class UsersProject < ActiveRecord::Base
after_save :update_repository
after_destroy :update_repository
validates_uniqueness_of :user_id, :scope => [:project_id]
validates_uniqueness_of :user_id, scope: [:project_id]
validates_presence_of :user_id
validates_presence_of :project_id
delegate :name, :email, :to => :user, :prefix => true
delegate :name, :email, to: :user, prefix: true
def self.bulk_import(project, user_ids, project_access)
UsersProject.transaction do
user_ids.each do |user_id|
users_project = UsersProject.new(
:project_access => project_access,
:user_id => user_id
project_access: project_access,
user_id: user_id
)
users_project.project = project
users_project.save
......@@ -35,7 +35,7 @@ class UsersProject < ActiveRecord::Base
UsersProject.transaction do
project_ids.each do |project_id|
users_project = UsersProject.new(
:project_access => project_access,
project_access: project_access,
)
users_project.project_id = project_id
users_project.user_id = user.id
......
class Wiki < ActiveRecord::Base
belongs_to :project
belongs_to :user
has_many :notes, :as => :noteable, :dependent => :destroy
has_many :notes, as: :noteable, dependent: :destroy
validates :content, :title, :user_id, :presence => true
validates :title, :length => 1..250
validates :content, :title, :user_id, presence: true
validates :title, length: 1..250
before_update :set_slug
......
......@@ -3,22 +3,22 @@ class ActivityObserver < ActiveRecord::Observer
def after_create(record)
Event.create(
:project => record.project,
:target_id => record.id,
:target_type => record.class.name,
:action => Event.determine_action(record),
:author_id => record.author_id
project: record.project,
target_id: record.id,
target_type: record.class.name,
action: Event.determine_action(record),
author_id: record.author_id
)
end
def after_save(record)
if record.changed.include?("closed")
Event.create(
:project => record.project,
:target_id => record.id,
:target_type => record.class.name,
:action => (record.closed ? Event::Closed : Event::Reopened),
:author_id => record.author_id_of_changes
project: record.project,
target_id: record.id,
target_type: record.class.name,
action: (record.closed ? Event::Closed : Event::Reopened),
author_id: record.author_id_of_changes
)
end
end
......
......@@ -71,7 +71,7 @@ class MailerObserver < ActiveRecord::Observer
# Create comment about status changed
if target.closed_changed?
note = Note.new(:noteable => target, :project => target.project)
note = Note.new(noteable: target, project: target.project)
note.author = current_user
note.note = "_Status changed to #{target.closed ? 'closed' : 'reopened'}_"
note.save()
......
......@@ -24,7 +24,7 @@ module Account
end
def cared_merge_requests
MergeRequest.where("author_id = :id or assignee_id = :id", :id => self.id).opened
MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id).opened
end
def project_ids
......@@ -50,7 +50,7 @@ module Account
def recent_push project_id = nil
# Get push events not earlier than 2 hours ago
events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
events = events.where(:project_id => project_id) if project_id
events = events.where(project_id: project_id) if project_id
# Take only latest one
events = events.recent.limit(1).first
......
......@@ -3,56 +3,56 @@ module Authority
# Should be rewrited for new access rights
def add_access(user, *access)
access = if access.include?(:admin)
{ :project_access => UsersProject::MASTER }
{ project_access: UsersProject::MASTER }
elsif access.include?(:write)
{ :project_access => UsersProject::DEVELOPER }
{ project_access: UsersProject::DEVELOPER }
else
{ :project_access => UsersProject::REPORTER }
{ project_access: UsersProject::REPORTER }
end
opts = { :user => user }
opts = { user: user }
opts.merge!(access)
users_projects.create(opts)
end
def reset_access(user)
users_projects.where(:project_id => self.id, :user_id => user.id).destroy if self.id
users_projects.where(project_id: self.id, user_id: user.id).destroy if self.id
end
def repository_readers
keys = Key.joins({:user => :users_projects}).
keys = Key.joins({user: :users_projects}).
where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::REPORTER)
keys.map(&:identifier) + deploy_keys.map(&:identifier)
end
def repository_writers
keys = Key.joins({:user => :users_projects}).
keys = Key.joins({user: :users_projects}).
where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::DEVELOPER)
keys.map(&:identifier)
end
def repository_masters
keys = Key.joins({:user => :users_projects}).
keys = Key.joins({user: :users_projects}).
where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::MASTER)
keys.map(&:identifier)
end
def allow_read_for?(user)
!users_projects.where(:user_id => user.id).empty?
!users_projects.where(user_id: user.id).empty?
end
def guest_access_for?(user)
!users_projects.where(:user_id => user.id).empty?
!users_projects.where(user_id: user.id).empty?
end
def report_access_for?(user)
!users_projects.where(:user_id => user.id, :project_access => [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
!users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
end
def dev_access_for?(user)
!users_projects.where(:user_id => user.id, :project_access => [UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
!users_projects.where(user_id: user.id, project_access: [UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
end
def master_access_for?(user)
!users_projects.where(:user_id => user.id, :project_access => [UsersProject::MASTER]).empty? || owner_id == user.id
!users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty? || owner_id == user.id
end
end
......@@ -6,39 +6,39 @@ module IssueCommonality
attr_protected :author, :author_id, :project, :project_id
belongs_to :project
belongs_to :author, :class_name => "User"
belongs_to :assignee, :class_name => "User"
has_many :notes, :as => :noteable, :dependent => :destroy
belongs_to :author, class_name: "User"
belongs_to :assignee, class_name: "User"
has_many :notes, as: :noteable, dependent: :destroy
validates_presence_of :project_id
validates_presence_of :author_id
validates :title,
:presence => true,
:length => { :within => 0..255 }
presence: true,
length: { within: 0..255 }
scope :opened, where(:closed => false)
scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
scope :opened, where(closed: false)
scope :closed, where(closed: true)
scope :assigned, lambda { |u| where(assignee_id: u.id)}
delegate :name,
:email,
:to => :author,
:prefix => true
to: :author,
prefix: true
delegate :name,
:email,
:to => :assignee,
:allow_nil => true,
:prefix => true
to: :assignee,
allow_nil: true,
prefix: true
attr_accessor :author_id_of_changes
end
module ClassMethods
def search(query)
where("title like :query", :query => "%#{query}%")
where("title like :query", query: "%#{query}%")
end
end
......
......@@ -3,10 +3,10 @@ module ProjectPush
data = post_receive_data(oldrev, newrev, ref, user)
Event.create(
:project => self,
:action => Event::Pushed,
:data => data,
:author_id => data[:user_id]
project: self,
action: Event::Pushed,
data: data,
author_id: data[:user_id]
)
end
......@@ -20,7 +20,7 @@ module ProjectPush
mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
# Close merge requests
mrs = self.merge_requests.opened.where(:target_branch => branch_name).all
mrs = self.merge_requests.opened.where(target_branch: branch_name).all
mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
mrs.each { |merge_request| merge_request.merge!(user.id) }
......
......@@ -9,7 +9,7 @@ module SshKey
def repository_delete_key
Gitlab::GitHost.system.new.configure do |c|
#delete key file is there is no identically deploy keys
if !is_deploy_key || Key.where(:identifier => identifier).count() == 0
if !is_deploy_key || Key.where(identifier: identifier).count() == 0
c.delete_key(identifier)
end
c.update_projects(projects)
......
......@@ -25,8 +25,8 @@ module Team
# with passed access role by user id
def add_user_id_to_team(user_id, access_role)
users_projects.create(
:user_id => user_id,
:project_access => access_role
user_id: user_id,
project_access: access_role
)
end
......
......@@ -23,7 +23,7 @@ class AttachmentUploader < CarrierWave::Uploader::Base
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
# process scale: [200, 300]
#
# def scale(width, height)
# # do something
......@@ -31,7 +31,7 @@ class AttachmentUploader < CarrierWave::Uploader::Base
# Create different versions of your uploaded files:
# version :thumb do
# process :scale => [50, 50]
# process scale: [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
......
......@@ -5,11 +5,11 @@
Resque Workers
.data.padded
= link_to admin_resque_path do
%h1{:class => @workers.present? ? "cgreen" : "cred"}
%h1{class: @workers.present? ? "cgreen" : "cred"}
= @workers.count
%hr
%p
%strong{:class => @pending_jobs > 0 ? "cred" : "cgreen"}
%strong{class: @pending_jobs > 0 ? "cred" : "cgreen"}
#{@pending_jobs} post receive jobs waiting
.span4
......@@ -19,7 +19,7 @@
= link_to admin_projects_path do
%h1= Project.count
%hr
= link_to 'New Project', new_admin_project_path, :class => "btn small"
= link_to 'New Project', new_admin_project_path, class: "btn small"
.span4
.ui-box
%h5 Users
......@@ -27,7 +27,7 @@
= link_to admin_users_path do
%h1= User.count
%hr
= link_to 'New User', new_admin_user_path, :class => "btn small"
= link_to 'New User', new_admin_user_path, class: "btn small"
.row
......
......@@ -3,9 +3,9 @@
Post receive hooks for binding events.
%br
Read more about system hooks
%strong #{link_to "here", help_system_hooks_path, :class => "vlink"}
%strong #{link_to "here", help_system_hooks_path, class: "vlink"}
= form_for @hook, :as => :hook, :url => admin_hooks_path do |f|
= form_for @hook, as: :hook, url: admin_hooks_path do |f|
-if @hook.errors.any?
.alert-message.block-message.error
- @hook.errors.full_messages.each do |msg|
......@@ -13,9 +13,9 @@
.clearfix
= f.label :url, "URL:"
.input
= f.text_field :url, :class => "text_field xxlarge"
= f.text_field :url, class: "text_field xxlarge"
&nbsp;
= f.submit "Add System Hook", :class => "btn primary"
= f.submit "Add System Hook", class: "btn primary"
%hr
-if @hooks.any?
......@@ -33,7 +33,7 @@
%td
= link_to admin_hook_path(hook) do
%strong= hook.url
= link_to 'Test Hook', admin_hook_test_path(hook), :class => "btn small right"
= link_to 'Test Hook', admin_hook_test_path(hook), class: "btn small right"
%td POST
%td
= link_to 'Remove', admin_hook_path(hook), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn small right"
= link_to 'Remove', admin_hook_path(hook), confirm: 'Are you sure?', method: :delete, class: "danger btn small right"
......@@ -9,8 +9,8 @@
= f.label :name do
Project name is
.input
= f.text_field :name, :placeholder => "Example Project", :class => "xxlarge"
= f.submit project.new_record? ? 'Create project' : 'Save Project', :class => "btn primary"
= f.text_field :name, placeholder: "Example Project", class: "xxlarge"
= f.submit project.new_record? ? 'Create project' : 'Save Project', class: "btn primary"
%hr
.alert.alert-info
......@@ -21,7 +21,7 @@
.input
.input-prepend
%span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !!project.id
= f.text_field :path, placeholder: "example_project", disabled: !!project.id
%span.add-on= ".git"
.clearfix
= f.label :code do
......@@ -29,7 +29,7 @@
.input
.input-prepend
%span.add-on= web_app_url
= f.text_field :code, :placeholder => "example"
= f.text_field :code, placeholder: "example"
- unless project.new_record?
.clearfix
......@@ -39,7 +39,7 @@
- if project.repo_exists?
.clearfix
= f.label :default_branch, "Default Branch"
.input= f.select(:default_branch, project.heads.map(&:name), {}, :style => "width:210px;")
.input= f.select(:default_branch, project.heads.map(&:name), {}, style: "width:210px;")
- unless project.new_record?
.alert.alert-info
......@@ -63,7 +63,7 @@
- unless project.new_record?
.actions
= f.submit 'Save Project', :class => "btn primary"
= f.submit 'Save Project', class: "btn primary"
......
%h3.page_title #{@admin_project.name} &rarr; Edit project
%hr
= render 'form', :project => @admin_project
= render 'form', project: @admin_project
%h3
Projects
= link_to 'New Project', new_admin_project_path, :class => "btn small right"
= link_to 'New Project', new_admin_project_path, class: "btn small right"
%br
= form_tag admin_projects_path, :method => :get do
= text_field_tag :name, params[:name], :class => "xlarge"
= submit_tag "Search", :class => "btn submit primary"
= form_tag admin_projects_path, method: :get do
= text_field_tag :name, params[:name], class: "xlarge"
= submit_tag "Search", class: "btn submit primary"
%table.admin-table
%thead
......@@ -21,8 +21,8 @@
%td= link_to project.name, [:admin, project]
%td= project.path
%td= project.users_projects.count
%td= check_box_tag :post_receive_file, 1, project.has_post_receive_file?, :disabled => true
%td= check_box_tag :post_receive_file, 1, project.has_post_receive_file?, disabled: true
%td= last_commit(project)
%td= link_to 'Edit', edit_admin_project_path(project), :id => "edit_#{dom_id(project)}", :class => "btn small"
%td.bgred= link_to 'Destroy', [:admin, project], :confirm => "REMOVE #{project.name}? Are you sure?", :method => :delete, :class => "btn small danger"
= paginate @admin_projects, :theme => "admin"
%td= link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small"
%td.bgred= link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger"
= paginate @admin_projects, theme: "admin"
%h3.page_title New project
%hr
= render 'form', :project => @admin_project
= render 'form', project: @admin_project
%h3
= @admin_project.name
= link_to 'Edit', edit_admin_project_path(@admin_project), :class => "btn right small"
= link_to 'Edit', edit_admin_project_path(@admin_project), class: "btn right small"
%br
%table.zebra-striped.table-bordered
......@@ -33,7 +33,7 @@
%b
Post Receive File:
%td
= check_box_tag :post_receive_file, 1, @admin_project.has_post_receive_file?, :disabled => true
= check_box_tag :post_receive_file, 1, @admin_project.has_post_receive_file?, disabled: true
%br
%h3
Team
......@@ -52,14 +52,14 @@
%tr
%td
= link_to tm.user_name, admin_user_path(tm.user)
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "medium project-access-select", :disabled => :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), :class => "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete, :class => "btn danger small"
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), class: "medium project-access-select", disabled: :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), class: "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn danger small"
%br
%h3 Add new team member
%br
= form_tag team_update_admin_project_path(@admin_project), :class => "bulk_import", :method => :put do
= form_tag team_update_admin_project_path(@admin_project), class: "bulk_import", method: :put do
%table.zebra-striped.table-bordered
%thead
%tr
......@@ -67,14 +67,14 @@
%th Project Access:
%tr
%td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), :multiple => true
%td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select"
%td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true
%td= select_tag :project_access, options_for_select(Project.access_options), class: "project-access-select"
%tr
%td= submit_tag 'Add', :class => "btn primary"
%td= submit_tag 'Add', class: "btn primary"
%td
Read more about project permissions
%strong= link_to "here", help_permissions_path, :class => "vlink"
%strong= link_to "here", help_permissions_path, class: "vlink"
:css
form select {
......
%h3 Resque
%iframe{:src => "/info/resque", :width => 1168, :height => 600, :style => "border: none"}
\ No newline at end of file
%iframe{src: "/info/resque", width: 1168, height: 600, style: "border: none"}
\ No newline at end of file
= form_for @admin_team_member, :as => :team_member, :url => admin_team_member_path(@admin_team_member) do |f|
= form_for @admin_team_member, as: :team_member, url: admin_team_member_path(@admin_team_member) do |f|
-if @admin_team_member.errors.any?
.alert-message.block-message.error
%ul
......@@ -8,12 +8,12 @@
.clearfix
%label Project Access:
.input
= f.select :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), {}, :class => "project-access-select"
= f.select :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), {}, class: "project-access-select"
%br
.actions
= f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', :back, :class => "btn"
= f.submit 'Save', class: "btn primary"
= link_to 'Cancel', :back, class: "btn"
:css
form select {
......
......@@ -22,17 +22,17 @@
-if f.object.new_record?
.clearfix
= f.label :admin, :class => "checkbox" do
= f.label :admin, class: "checkbox" do
= f.check_box :force_random_password, {}, true, nil
%span Generate random password
%div.password-fields
.clearfix
= f.label :password
.input= f.password_field :password, :disabled => f.object.force_random_password
.input= f.password_field :password, disabled: f.object.force_random_password
.clearfix
= f.label :password_confirmation
.input= f.password_field :password_confirmation, :disabled => f.object.force_random_password
.input= f.password_field :password_confirmation, disabled: f.object.force_random_password
%hr
.clearfix
= f.label :skype
......@@ -46,27 +46,27 @@
.span6
.clearfix
= f.label :projects_limit
.input= f.text_field :projects_limit, :class => "small_input"
.input= f.text_field :projects_limit, class: "small_input"
.alert
.clearfix
%p Make the user a GitLab administrator.
= f.label :admin, :class => "checkbox" do
= f.label :admin, class: "checkbox" do
= f.check_box :admin
%span Administrator
- unless @admin_user.new_record?
.alert.alert-error
- if @admin_user.blocked
%span
= link_to 'Unblock', unblock_admin_user_path(@admin_user), :method => :put, :class => "btn small"
= link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn small"
This user is blocked and is not able to login to GitLab
- else
%span
= link_to 'Block', block_admin_user_path(@admin_user), :confirm => 'USER WILL BE BLOCKED! Are you sure?', :method => :put, :class => "btn small danger"
= link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger"
Blocked users will be removed from all projects &amp; will not be able to login to GitLab.
.actions
= f.submit 'Save', :class => "btn primary"
= f.submit 'Save', class: "btn primary"
- if @admin_user.new_record?
= link_to 'Cancel', admin_users_path, :class => "btn"
= link_to 'Cancel', admin_users_path, class: "btn"
- else
= link_to 'Cancel', admin_user_path(@admin_user), :class => "btn"
= link_to 'Cancel', admin_user_path(@admin_user), class: "btn"
%h3
Users
= link_to 'New User', new_admin_user_path, :class => "btn small right"
= link_to 'New User', new_admin_user_path, class: "btn small right"
%br
= form_tag admin_users_path, :method => :get do
= text_field_tag :name, params[:name], :class => "xlarge"
= submit_tag "Search", :class => "btn submit primary"
= form_tag admin_users_path, method: :get do
= text_field_tag :name, params[:name], class: "xlarge"
= submit_tag "Search", class: "btn submit primary"
%ul.nav.nav-pills
%li{:class => "#{'active' unless params[:filter]}"}
%li{class: "#{'active' unless params[:filter]}"}
= link_to "Active", admin_users_path
%li{:class => "#{'active' if params[:filter] == "admins"}"}
= link_to admin_users_path(:filter => "admins") do
%li{class: "#{'active' if params[:filter] == "admins"}"}
= link_to admin_users_path(filter: "admins") do
Admins
%li{:class => "#{'active' if params[:filter] == "blocked"}"}
= link_to admin_users_path(:filter => "blocked") do
%li{class: "#{'active' if params[:filter] == "blocked"}"}
= link_to admin_users_path(filter: "blocked") do
Blocked
%li{:class => "#{'active' if params[:filter] == "wop"}"}
= link_to admin_users_path(:filter => "wop") do
%li{class: "#{'active' if params[:filter] == "wop"}"}
= link_to admin_users_path(filter: "wop") do
Without projects
%table.admin-table
......@@ -31,16 +31,16 @@
- @admin_users.each do |user|
%tr
%td= check_box_tag "admin", 1, user.admin, :disabled => :disabled
%td= check_box_tag "admin", 1, user.admin, disabled: :disabled
%td= link_to user.name, [:admin, user]
%td= user.email
%td= user.users_projects.count
%td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}", :class => "btn small"
%td= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn small"
%td
- if user.blocked
= link_to 'Unblock', unblock_admin_user_path(user), :method => :put, :class => "btn small success"
= link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn small success"
- else
= link_to 'Block', block_admin_user_path(user), :confirm => 'USER WILL BE BLOCKED! Are you sure?', :method => :put, :class => "btn small danger"
%td.bgred= link_to 'Destroy', [:admin, user], :confirm => "USER #{user.name} WILL BE REMOVED! Are you sure?", :method => :delete, :class => "btn small danger"
= link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger"
%td.bgred= link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn small danger"
= paginate @admin_users, :theme => "admin"
= paginate @admin_users, theme: "admin"
......@@ -4,7 +4,7 @@
%small Blocked
- if @admin_user.admin
%small Administrator
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn small right"
= link_to 'Edit', edit_admin_user_path(@admin_user), class: "btn small right"
%br
......@@ -19,12 +19,12 @@
%td
%b
Admin:
%td= check_box_tag "admin", 1, @admin_user.admin, :disabled => :disabled
%td= check_box_tag "admin", 1, @admin_user.admin, disabled: :disabled
%tr
%td
%b
Blocked:
%td= check_box_tag "blocked", 1, @admin_user.blocked, :disabled => :disabled
%td= check_box_tag "blocked", 1, @admin_user.blocked, disabled: :disabled
%tr
%td
%b
......@@ -56,7 +56,7 @@
%br
%h3 Add User to Projects
%br
= form_tag team_update_admin_user_path(@admin_user), :class => "bulk_import", :method => :put do
= form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do
%table.table-bordered
%thead
%tr
......@@ -64,14 +64,14 @@
%th Project Access:
%tr
%td= select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name), :multiple => true
%td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select"
%td= select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name), multiple: true
%td= select_tag :project_access, options_for_select(Project.access_options), class: "project-access-select"
%tr
%td= submit_tag 'Add', :class => "btn primary"
%td= submit_tag 'Add', class: "btn primary"
%td
Read more about project permissions
%strong= link_to "here", help_permissions_path, :class => "vlink"
%strong= link_to "here", help_permissions_path, class: "vlink"
%br
- if @admin_user.projects.present?
......@@ -90,9 +90,9 @@
- project = tm.project
%tr
%td= link_to project.name, admin_project_path(project)
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "medium project-access-select", :disabled => :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), :class => "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), class: "medium project-access-select", disabled: :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), class: "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn small danger"
:css
form select {
......
%li.commit
.browse_code_link_holder
%p
%strong= link_to "Browse Code »", tree_project_ref_path(@project, commit.id), :class => "right"
%strong= link_to "Browse Code »", tree_project_ref_path(@project, commit.id), class: "right"
%p
= link_to commit.short_id(8), project_commit_path(@project, :id => commit.id), :class => "commit_short_id"
= link_to commit.short_id(8), project_commit_path(@project, id: commit.id), class: "commit_short_id"
%strong.cgray= commit.author_name
&ndash;
= image_tag gravatar_icon(commit.author_email), :class => "avatar", :width => 16
= link_to_gfm truncate(commit.title, :length => 50), project_commit_path(@project, :id => commit.id), :class => "row_title"
= image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16
= link_to_gfm truncate(commit.title, length: 50), project_commit_path(@project, id: commit.id), class: "row_title"
%span.committed_ago
= time_ago_in_words(commit.committed_date)
......
......@@ -5,10 +5,10 @@
%span.btn.disabled.grouped
%i.icon-comment
= @notes_count
= link_to patch_project_commit_path(@project, @commit.id), :class => "btn small grouped" do
= link_to patch_project_commit_path(@project, @commit.id), class: "btn small grouped" do
%i.icon-download-alt
Get Patch
= link_to tree_project_ref_path(@project, @commit.id), :class => "browse-button primary grouped" do
= link_to tree_project_ref_path(@project, @commit.id), class: "browse-button primary grouped" do
%strong Browse Code »
%h3.commit-title.page_title
= gfm @commit.title
......@@ -18,7 +18,7 @@
.commit-info
.row
.span4
= image_tag gravatar_icon(@commit.author_email, 40), :class => "avatar"
= image_tag gravatar_icon(@commit.author_email, 40), class: "avatar"
.author
%strong= @commit.author_name
authored
......
......@@ -3,24 +3,24 @@
%li
- if diff.deleted_file
%span.removed_file
%a{:href => "##{diff.old_path}"}
%a{href: "##{diff.old_path}"}
= diff.old_path
= image_tag "diff_file_delete.png"
- elsif diff.renamed_file
%span.moved_file
%a{:href => "##{diff.new_path}"}
%a{href: "##{diff.new_path}"}
= diff.old_path
= "->"
= diff.new_path
= image_tag "diff_file_notice.png"
- elsif diff.new_file
%span.new_file
%a{:href => "##{diff.new_path}"}
%a{href: "##{diff.new_path}"}
= diff.new_path
= image_tag "diff_file_add.png"
- else
%span.edit_file
%a{:href => "##{diff.new_path}"}
%a{href: "##{diff.new_path}"}
= diff.new_path
= image_tag "diff_file_info.png"
......@@ -5,12 +5,12 @@
%p To prevent performance issue we rejected diff information.
%p
But if you still want to see diff
= link_to "click this link", project_commit_path(@project, @commit.id, :force_show_diff => true), :class => "dark"
= link_to "click this link", project_commit_path(@project, @commit.id, force_show_diff: true), class: "dark"
%p.cgray
Showing #{pluralize(diffs.count, "changed file")}
.file_stats
= render "commits/diff_head", :diffs => diffs
= render "commits/diff_head", diffs: diffs
- unless @suppress_diff
- diffs.each_with_index do |diff, i|
......@@ -22,26 +22,26 @@
.diff_file_header
- if diff.deleted_file
%i.icon-file
%span{:id => "#{diff.old_path}"}= diff.old_path
%span{id: "#{diff.old_path}"}= diff.old_path
- else
= link_to tree_file_project_ref_path(@project, @commit.id, diff.new_path) do
%i.icon-file
%span{:id => "#{diff.new_path}"}= diff.new_path
%span{id: "#{diff.new_path}"}= diff.new_path
%br/
.diff_file_content
-# Skipp all non non-supported blobs
- next unless file.respond_to?('text?')
- if file.text?
= render "commits/text_file", :diff => diff, :index => i
= render "commits/text_file", diff: diff, index: i
- elsif file.image?
- if diff.renamed_file || diff.new_file || diff.deleted_file
.diff_file_content_image
%img{:class => image_diff_class(diff), :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
%img{class: image_diff_class(diff), src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
- else
- old_file = (@commit.prev_commit.tree / diff.old_path)
.diff_file_content_image.img_compared
%img{:class => "diff_image_removed", :src => "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
%img{:class => "diff_image_added", :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
%img{class: "diff_image_removed", src: "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
%img{class: "diff_image_added", src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
- else
%p.nothing_here_message No preview for this file type
%ul.nav.nav-tabs
%li
= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form" do
= select_tag "ref", grouped_options_refs, :onchange => "$(this.form).trigger('submit');", :class => "project-refs-select"
= form_tag switch_project_refs_path(@project), method: :get, class: "project-refs-form" do
= select_tag "ref", grouped_options_refs, onchange: "$(this.form).trigger('submit');", class: "project-refs-select"
= hidden_field_tag :destination, "commits"
%li{:class => "#{'active' if current_page?(project_commits_path(@project)) }"}
%li{class: "#{'active' if current_page?(project_commits_path(@project)) }"}
= link_to project_commits_path(@project) do
Commits
%li{:class => "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
%li{class: "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
= link_to compare_project_commits_path(@project) do
Compare
%li{:class => "#{branches_tab_class}"}
%li{class: "#{branches_tab_class}"}
= link_to project_repository_path(@project) do
Branches
%span.badge= @project.repo.branch_count
%li{:class => "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
%li{class: "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
= link_to tags_project_repository_path(@project) do
Tags
%span.badge= @project.repo.tag_count
......@@ -24,8 +24,8 @@
- if current_page?(project_commits_path(@project)) && current_user.private_token
%li.right
%span.rss-icon
= link_to project_commits_path(@project, :atom, { :private_token => current_user.private_token, :ref => @ref }), :title => "Feed" do
= image_tag "rss_ui.png", :title => "feed"
= link_to project_commits_path(@project, :atom, { private_token: current_user.private_token, ref: @ref }), title: "Feed" do
= image_tag "rss_ui.png", title: "feed"
:javascript
$(function(){
......
......@@ -2,7 +2,7 @@
- if too_big
%a.supp_diff_link Diff suppressed. Click to show
%table{:class => "#{'hide' if too_big}"}
%table{class: "#{'hide' if too_big}"}
- each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old|
%tr.line_holder
- if type == "match"
......@@ -11,16 +11,16 @@
%td.line_content.matched= line
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", :id => line_code
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- if @comments_allowed
= link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line"
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", :id => line_code
%td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;"
= link_to "", "#", class: "line_note_link", "line_code" => line_code, title: "Add note for this line"
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;"
- if @comments_allowed
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse
- unless comments.empty?
- comments.each_with_index do |note, i|
= render "notes/reply_button", :line_code => line_code if i.zero?
= render "notes/per_line_show", :note => note
= render "notes/reply_button", line_code: line_code if i.zero?
= render "notes/per_line_show", note: note
- @line_notes.reject!{ |n| n == note }
......@@ -14,13 +14,13 @@
%br
= form_tag compare_project_commits_path(@project), :method => :get do
= form_tag compare_project_commits_path(@project), method: :get do
.clearfix
= text_field_tag :from, params[:from], :placeholder => "master", :class => "xlarge"
= text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
= "..."
= text_field_tag :to, params[:to], :placeholder => "aa8b4ef", :class => "xlarge"
= text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
.actions
= submit_tag "Compare", :class => "btn btn-primary"
= submit_tag "Compare", class: "btn btn-primary"
- unless @commits.empty?
......@@ -30,7 +30,7 @@
- unless @diffs.empty?
%h4 Diff
= render "commits/diffs", :diffs => @diffs
= render "commits/diffs", diffs: @diffs
:javascript
$(function() {
......
......@@ -9,12 +9,12 @@
%span.divider
\/
%li
%a{:href => "#"}= params[:path].split("/").join(" / ")
%a{href: "#"}= params[:path].split("/").join(" / ")
%div{:id => dom_id(@project)}
%div{id: dom_id(@project)}
#commits_list= render "commits"
.clear
.loading{ :style => "display:none;"}
.loading{ style: "display:none;"}
- if @commits.count == @limit
:javascript
......
:plain
CommitsList.append(#{@commits.count}, "#{escape_javascript(render(:partial => 'commits/commits'))}");
CommitsList.append(#{@commits.count}, "#{escape_javascript(render(partial: 'commits/commits'))}");
= render "commits/commit_box"
= render "commits/diffs", :diffs => @commit.diffs
= render "notes/notes", :tid => @commit.id, :tt => "commit"
= render "commits/diffs", diffs: @commit.diffs
= render "notes/notes", tid: @commit.id, tt: "commit"
= render "notes/per_line_form"
......
......@@ -6,7 +6,7 @@
%span
You wont be able to pull/push project code unless you
%strong
= link_to new_key_path, :class => "vlink" do
= link_to new_key_path, class: "vlink" do
add new key
to your profile
- if @events.any?
......@@ -15,7 +15,7 @@
%h4.nothing_here_message Projects activity will be displayed here
.loading.hide
.side
= render "events/event_last_push", :event => @last_push
= render "events/event_last_push", event: @last_push
.projects_box
%h5
Projects
......@@ -23,23 +23,23 @@
(#{@projects.total_count})
- if current_user.can_create_project?
%span.right
= link_to new_project_path, :class => "btn very_small info" do
= link_to new_project_path, class: "btn very_small info" do
%i.icon-plus
New Project
- @projects.each do |project|
= link_to project_path(project), :class => dom_class(project) do
= link_to project_path(project), class: dom_class(project) do
%h4
%span.ico.project
= truncate(project.name, :length => 25)
= truncate(project.name, length: 25)
%span.right
&rarr;
.bottom= paginate @projects, :theme => "gitlab"
.bottom= paginate @projects, theme: "gitlab"
%hr
%div
%span.rss-icon
= link_to dashboard_path(:atom, { :private_token => current_user.private_token }) do
= image_tag "rss_ui.png", :title => "feed"
= link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
= image_tag "rss_ui.png", title: "feed"
%strong News Feed
- else
......@@ -51,7 +51,7 @@
= current_user.projects_limit
projects. Click on button below to add a new one
.link_holder
= link_to new_project_path, :class => "btn primary" do
= link_to new_project_path, class: "btn primary" do
New Project »
- else
If you will be added to project - it will be displayed here
......
......@@ -12,8 +12,8 @@
%h5= @project.name
%ul.unstyled.issues_table
- group[1].each do |issue|
= render(:partial => 'issues/show', :locals => {:issue => issue})
= render(partial: 'issues/show', locals: {issue: issue})
%hr
= paginate @issues, :theme => "gitlab"
= paginate @issues, theme: "gitlab"
- else
%h3.nothing_here_message Nothing to show here
......@@ -10,9 +10,9 @@
- @project = group[0]
%h5= @project.name
- group[1].each do |merge_request|
= render(:partial => 'merge_requests/merge_request', :locals => {:merge_request => merge_request})
= render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request})
%hr
= paginate @merge_requests, :theme => "gitlab"
= paginate @merge_requests, theme: "gitlab"
- else
%h3.nothing_here_message Nothing to show here
%div
= form_for [@project, @key], :url => project_deploy_keys_path do |f|
= form_for [@project, @key], url: project_deploy_keys_path do |f|
-if @key.errors.any?
.alert-message.block-message.error
%ul
......@@ -11,8 +11,8 @@
.input= f.text_field :title
.clearfix
= f.label :key
.input= f.text_area :key, :class => "xlarge"
.input= f.text_area :key, class: "xlarge"
.actions
= f.submit 'Save', :class => "primary btn"
= link_to "Cancel", project_deploy_keys_path(@project), :class => "btn"
= f.submit 'Save', class: "primary btn"
= link_to "Cancel", project_deploy_keys_path(@project), class: "btn"
%tr
%td
%a{:href => project_deploy_key_path(key.project, key)}
%a{href: project_deploy_key_path(key.project, key)}
%strong= key.title
%td
%span.update-author
......@@ -8,5 +8,5 @@
= time_ago_in_words(key.created_at)
ago
%td
= link_to 'Remove', project_deploy_key_path(key.project, key), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn delete-key small right"
= link_to 'Remove', project_deploy_key_path(key.project, key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key small right"
......@@ -2,10 +2,10 @@
- if can? current_user, :admin_project, @project
.alert-message.block-message
Deploy keys allow read-only access to repository.
= link_to new_project_deploy_key_path(@project), :class => "btn small", :title => "New Deploy Key" do
= link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do
Add Deploy Key
- if @keys.any?
%table
- @keys.each do |key|
= render(:partial => 'show', :locals => {:key => key})
= render(partial: 'show', locals: {key: key})
......@@ -3,5 +3,5 @@
%hr
%pre= @key.key
.actions
= link_to 'Remove', project_deploy_key_path(@key.project, @key), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn delete-key"
= link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key"
.clear
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, :class => "login-box" }) do |f|
= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo"
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "login-box" }) do |f|
= image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo"
%h3 Change your password
= devise_error_messages!
= f.hidden_field :reset_password_token
%div
= f.password_field :password, :class => "text top", :placeholder => "New password"
= f.password_field :password, class: "text top", placeholder: "New password"
%div
= f.password_field :password_confirmation, :class => "text bottom", :placeholder => "Confirm new password"
= f.password_field :password_confirmation, class: "text bottom", placeholder: "Confirm new password"
%div
= f.submit "Change my password", :class => "btn primary"
.right= render :partial => "devise/shared/links"
= f.submit "Change my password", class: "btn primary"
.right= render partial: "devise/shared/links"
......@@ -2,4 +2,4 @@
%h3 Access Denied
%hr
%p Youre not allowed to access this page
%p Read more about project permissions #{link_to "here", help_permissions_path, :class => "vlink"}
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
- commit = CommitDecorator.decorate(commit)
%li.wll.commit
%p
= link_to commit.short_id(8), project_commit_path(project, :id => commit.id), :class => "commit_short_id"
= link_to commit.short_id(8), project_commit_path(project, id: commit.id), class: "commit_short_id"
%strong.cdark= commit.author_name
&ndash;
= image_tag gravatar_icon(commit.author_email), :class => "avatar", :width => 16
= gfm truncate(commit.title, :length => 50), project_commit_path(project, :id => commit.id) rescue "--broken encoding"
= image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16
= gfm truncate(commit.title, length: 50), project_commit_path(project, id: commit.id) rescue "--broken encoding"
- if event.allowed?
- if event.issue?
.event_feed
= render "events/event_issue", :event => event
= render "events/event_issue", event: event
- elsif event.merge_request?
.event_feed
= render "events/event_merge_request", :event => event
= render "events/event_merge_request", event: event
- elsif event.push?
.event_feed
= render "events/event_push", :event => event
= render "events/event_push", event: event
= image_tag gravatar_icon(event.author_email), :class => "avatar"
= image_tag gravatar_icon(event.author_email), class: "avatar"
%strong #{event.author_name}
%span.event_label{:class => event.action_name}= event.action_name
%span.event_label{class: event.action_name}= event.action_name
issue
= link_to project_issue_path(event.project, event.issue) do
%strong= truncate event.issue_title
......
- if show_last_push_widget?(event)
.event_lp
%div
= image_tag gravatar_icon(event.author_email), :class => "avatar"
= image_tag gravatar_icon(event.author_email), class: "avatar"
%span Your pushed to
= event.ref_type
= link_to project_commits_path(event.project, :ref => event.ref_name) do
%strong= truncate(event.ref_name, :length => 28)
= link_to project_commits_path(event.project, ref: event.ref_name) do
%strong= truncate(event.ref_name, length: 28)
at
%strong= link_to event.project.name, event.project
= link_to new_mr_path_from_push_event(event), :title => "New Merge Request", :class => "btn very_small primary" do
= link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn very_small primary" do
Create Merge Request
- if event.action_name == "merged"
.event_icon= image_tag "event_mr_merged.png"
= image_tag gravatar_icon(event.author_email), :class => "avatar"
= image_tag gravatar_icon(event.author_email), class: "avatar"
%strong #{event.author_name}
%span.event_label{:class => event.action_name}= event.action_name
%span.event_label{class: event.action_name}= event.action_name
merge request
= link_to project_merge_request_path(event.project, event.merge_request) do
%strong= truncate event.merge_request_title
......
%div
.event_icon= image_tag "event_push.png"
= image_tag gravatar_icon(event.author_email), :class => "avatar"
= image_tag gravatar_icon(event.author_email), class: "avatar"
%strong #{event.author_name}
%span.event_label.pushed= event.push_action_name
= event.ref_type
= link_to project_commits_path(event.project, :ref => event.ref_name) do
= link_to project_commits_path(event.project, ref: event.ref_name) do
%strong= event.ref_name
at
%strong= link_to event.project.name, event.project
......@@ -14,17 +14,17 @@
- if event.push_with_commits?
- if event.commits_count > 1
= link_to compare_project_commits_path(event.project, :from => event.parent_commit.id, :to => event.last_commit.id) do
= link_to compare_project_commits_path(event.project, from: event.parent_commit.id, to: event.last_commit.id) do
%strong #{event.parent_commit.id[0..7]}...#{event.last_commit.id[0..7]}
- project = event.project
%ul.unstyled.event_commits
- if event.commits_count > 3
- event.commits[0...2].each do |commit|
= render "events/commit", :commit => commit, :project => project
= render "events/commit", commit: commit, project: project
%li
%br
\... and #{event.commits_count - 2} more commits
- else
- event.commits.each do |commit|
= render "events/commit", :commit => commit, :project => project
= render "events/commit", commit: commit, project: project
......@@ -6,13 +6,13 @@
%ol
%li
%a{:href => "#README"} README
%a{href: "#README"} README
%li
%a{:href => "#projects"} Projects
%a{href: "#projects"} Projects
%li
%a{:href => "#users"} Users
%a{href: "#users"} Users
%li
%a{:href => "#issues"} Issues
%a{href: "#issues"} Issues
.file_holder#README
.file_title
......
......@@ -6,9 +6,9 @@
Post receive hooks for binding events when someone push to repository.
%br
Read more about web hooks
%strong #{link_to "here", help_web_hooks_path, :class => "vlink"}
%strong #{link_to "here", help_web_hooks_path, class: "vlink"}
= form_for [@project, @hook], :as => :hook, :url => project_hooks_path(@project) do |f|
= form_for [@project, @hook], as: :hook, url: project_hooks_path(@project) do |f|
-if @hook.errors.any?
.alert-message.block-message.error
- @hook.errors.full_messages.each do |msg|
......@@ -16,9 +16,9 @@
.clearfix
= f.label :url, "URL:"
.input
= f.text_field :url, :class => "text_field xxlarge"
= f.text_field :url, class: "text_field xxlarge"
&nbsp;
= f.submit "Add Web Hook", :class => "btn primary"
= f.submit "Add Web Hook", class: "btn primary"
%hr
-if @hooks.any?
......@@ -36,7 +36,7 @@
%td
= link_to project_hook_path(@project, hook) do
%strong= hook.url
= link_to 'Test Hook', test_project_hook_path(@project, hook), :class => "btn small right"
= link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn small right"
%td POST
%td
= link_to 'Remove', project_hook_path(@project, hook), :confirm => 'Are you sure?', :method => :delete, :class => "danger btn small right"
= link_to 'Remove', project_hook_path(@project, hook), confirm: 'Are you sure?', method: :delete, class: "danger btn small right"
%div.issue-form-holder
%h3= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
= form_for [@project, @issue], :remote => request.xhr? do |f|
= form_for [@project, @issue], remote: request.xhr? do |f|
-if @issue.errors.any?
.alert-message.block-message.error
%ul
......@@ -12,18 +12,18 @@
= f.label :title do
%strong= "Subject *"
.input
= f.text_field :title, :maxlength => 255, :class => "xxlarge"
= f.text_field :title, maxlength: 255, class: "xxlarge"
.issue_middle_block
.issue_assignee
= f.label :assignee_id do
%i.icon-user
Assign to
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select a user" })
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" })
.issue_milestone
= f.label :milestone_id do
%i.icon-time
Milestone
.input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { :include_blank => "Select milestone" })
.input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" })
.issue_description
.clearfix
......@@ -31,26 +31,26 @@
%i.icon-tag
Labels
.input
= f.text_field :label_list, :maxlength => 2000, :class => "xxlarge"
= f.text_field :label_list, maxlength: 2000, class: "xxlarge"
%p.hint Separate with comma.
.clearfix
= f.label :description, "Details"
.input
= f.text_area :description, :maxlength => 2000, :class => "xxlarge", :rows => 14
= f.text_area :description, maxlength: 2000, class: "xxlarge", rows: 14
%p.hint Markdown is enabled.
.actions
- if @issue.new_record?
= f.submit 'Submit new issue', :class => "primary btn"
= f.submit 'Submit new issue', class: "primary btn"
-else
= f.submit 'Save changes', :class => "primary btn"
= f.submit 'Save changes', class: "primary btn"
- if request.xhr?
= link_to "Cancel", "#back", :onclick => "backToIssues();", :class => "btn"
= link_to "Cancel", "#back", onclick: "backToIssues();", class: "btn"
- else
- if @issue.new_record?
= link_to "Cancel", project_issues_path(@project), :class => "btn"
= link_to "Cancel", project_issues_path(@project), class: "btn"
- else
= link_to "Cancel", project_issue_path(@project, @issue), :class => "btn"
= link_to "Cancel", project_issue_path(@project, @issue), class: "btn"
%ul.nav.nav-tabs
%li{:class => "#{'active' if current_page?(project_issues_path(@project))}"}
= link_to project_issues_path(@project), :class => "tab" do
%li{class: "#{'active' if current_page?(project_issues_path(@project))}"}
= link_to project_issues_path(@project), class: "tab" do
Browse Issues
%li{:class => "#{'active' if current_page?(project_milestones_path(@project))}"}
= link_to project_milestones_path(@project), :class => "tab" do
%li{class: "#{'active' if current_page?(project_milestones_path(@project))}"}
= link_to project_milestones_path(@project), class: "tab" do
Milestones
%li.right
%span.rss-icon
= link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do
= image_tag "rss_ui.png", :title => "feed"
= link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do
= image_tag "rss_ui.png", title: "feed"
- @issues.each do |issue|
= render(:partial => 'issues/show', :locals => {:issue => issue})
= render(partial: 'issues/show', locals: {issue: issue})
- if @issues.present?
%li.bottom
.row
.span7= paginate @issues, :remote => true, :theme => "gitlab"
.span7= paginate @issues, remote: true, theme: "gitlab"
.span3.right
%span.cgray.right
%span.issue_counter #{@issues.total_count}
......
%li.wll{ :id => dom_id(issue), :class => issue_css_classes(issue), :url => project_issue_path(issue.project, issue) }
%li.wll{ id: dom_id(issue), class: issue_css_classes(issue), url: project_issue_path(issue.project, issue) }
- if controller.controller_name == 'issues'
.issue_check
= check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, :class => "selected_issue", :disabled => !can?(current_user, :modify_issue, issue)
= check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue", disabled: !can?(current_user, :modify_issue, issue)
.right
- issue.labels.each do |label|
%span.label.label-issue.grouped
......@@ -13,19 +13,19 @@
= issue.notes.count
- if can? current_user, :modify_issue, issue
- if issue.closed
= link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small grouped reopen_issue", :remote => true
= link_to 'Reopen', project_issue_path(issue.project, issue, issue: {closed: false }, status_only: true), method: :put, class: "btn small grouped reopen_issue", remote: true
- else
= link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small grouped close_issue", :remote => true
= link_to edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true do
= link_to 'Resolve', project_issue_path(issue.project, issue, issue: {closed: true }, status_only: true), method: :put, class: "success btn small grouped close_issue", remote: true
= link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link", remote: true do
%i.icon-edit
Edit
- if issue.assignee
= image_tag gravatar_icon(issue.assignee_email), :class => "avatar"
= image_tag gravatar_icon(issue.assignee_email), class: "avatar"
- else
= image_tag "no_avatar.png", :class => "avatar"
= image_tag "no_avatar.png", class: "avatar"
%p= link_to_gfm truncate(issue.title, :length => 100), project_issue_path(issue.project, issue), :class => "row_title"
%p= link_to_gfm truncate(issue.title, length: 100), project_issue_path(issue.project, issue), class: "row_title"
%span.update-author
%small.cdark= "##{issue.id}"
......
- if @issue.valid?
:plain
switchFromNewIssue();
$("#issues-table").prepend("#{escape_javascript(render(:partial => 'show', :locals => {:issue => @issue}))}");
$("#issues-table").prepend("#{escape_javascript(render(partial: 'show', locals: {issue: @issue}))}");
$.ajax({type: "GET", url: location.href, dataType: "script"});
- else
:plain
......
......@@ -6,51 +6,51 @@
.right
.span5
- if can? current_user, :write_issue, @project
= link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do
= link_to new_project_issue_path(@project), class: "right btn small", title: "New Issue", remote: true do
New Issue
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
= form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do
= hidden_field_tag :project_id, @project.id, { id: 'project_id' }
= hidden_field_tag :status, params[:f]
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' }
= search_field_tag :issue_search, nil, { placeholder: 'Search', class: 'issue_search span3 right neib' }
.clearfix
%div#issues-table-holder.ui-box
.title
= check_box_tag "check_all_issues", nil, false, :class => "check_all_issues left"
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
.issues_bulk_update.hide
= form_tag bulk_update_project_issues_path(@project), :method => :post do
= form_tag bulk_update_project_issues_path(@project), method: :post do
%span.update_issues_text Update selected issues with &nbsp;
.left
= select_tag('update[status]', options_for_select(['open', 'closed']), :prompt => "Status")
= select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee")
= select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone")
= select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
= select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
= select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :f, params[:f]
= button_tag "Save", :class => "btn update_selected_issues"
= button_tag "Save", class: "btn update_selected_issues"
.issues_filters
.left
%ul.nav.nav-pills.left
%li{:class => ("active" if (params[:f] == issues_filter[:open] || !params[:f]))}
= link_to project_issues_path(@project, :f => issues_filter[:open], :milestone_id => params[:milestone_id]) do
%li{class: ("active" if (params[:f] == issues_filter[:open] || !params[:f]))}
= link_to project_issues_path(@project, f: issues_filter[:open], milestone_id: params[:milestone_id]) do
Open
%li{:class => ("active" if params[:f] == issues_filter[:closed])}
= link_to project_issues_path(@project, :f => issues_filter[:closed], :milestone_id => params[:milestone_id]) do
%li{class: ("active" if params[:f] == issues_filter[:closed])}
= link_to project_issues_path(@project, f: issues_filter[:closed], milestone_id: params[:milestone_id]) do
Closed
%li{:class => ("active" if params[:f] == issues_filter[:to_me])}
= link_to project_issues_path(@project, :f => issues_filter[:to_me], :milestone_id => params[:milestone_id]) do
%li{class: ("active" if params[:f] == issues_filter[:to_me])}
= link_to project_issues_path(@project, f: issues_filter[:to_me], milestone_id: params[:milestone_id]) do
To Me
%li{:class => ("active" if params[:f] == issues_filter[:all])}
= link_to project_issues_path(@project, :f => issues_filter[:all], :milestone_id => params[:milestone_id]) do
%li{class: ("active" if params[:f] == issues_filter[:all])}
= link_to project_issues_path(@project, f: issues_filter[:all], milestone_id: params[:milestone_id]) do
All
.right
= form_tag project_issues_path(@project), :method => :get, :class => :right do
= select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), :prompt => "Labels")
= select_tag(:assignee_id, options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee")
= select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone")
= form_tag project_issues_path(@project), method: :get, class: :right do
= select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
= select_tag(:assignee_id, options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
= select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
= hidden_field_tag :f, params[:f]
.clearfix
......
......@@ -8,11 +8,11 @@
%span.right
- if can?(current_user, :admin_project, @project) || @issue.author == current_user
- if @issue.closed
= link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small"
= link_to 'Reopen', project_issue_path(@project, @issue, issue: {closed: false }, status_only: true), method: :put, class: "btn small"
- else
= link_to 'Close', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "btn small", :title => "Close Issue"
= link_to 'Close', project_issue_path(@project, @issue, issue: {closed: true }, status_only: true), method: :put, class: "btn small", title: "Close Issue"
- if can?(current_user, :admin_project, @project) || @issue.author == current_user
= link_to edit_project_issue_path(@project, @issue), :class => "btn small" do
= link_to edit_project_issue_path(@project, @issue), class: "btn small" do
%i.icon-edit
Edit
......@@ -35,18 +35,18 @@
.middle_box_content
%cite.cgray Created by
= image_tag gravatar_icon(@issue.author_email), :width => 16, :class => "lil_av"
= image_tag gravatar_icon(@issue.author_email), width: 16, class: "lil_av"
%strong.author= link_to_issue_author(@issue)
- if @issue.assignee
%cite.cgray and currently assigned to
= image_tag gravatar_icon(@issue.assignee_email), :width => 16, :class => "lil_av"
= image_tag gravatar_icon(@issue.assignee_email), width: 16, class: "lil_av"
%strong.author= link_to_issue_assignee(@issue)
- if @issue.milestone
- milestone = @issue.milestone
%cite.cgray and attached to milestone
%strong= link_to_gfm truncate(milestone.title, :length => 20), project_milestone_path(milestone.project, milestone)
%strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone)
.right
- @issue.labels.each do |label|
......@@ -61,4 +61,4 @@
= markdown @issue.description
.issue_notes#notes= render "notes/notes", :tid => @issue.id, :tt => "issue"
.issue_notes#notes= render "notes/notes", tid: @issue.id, tt: "issue"
......@@ -6,4 +6,4 @@
-# per_page: number of items to fetch per page
-# remote: data-remote
%span.first
= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote
= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment