From 775418918782d5284000ed0bfea364458c748567 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 10 Aug 2012 18:07:50 -0400 Subject: [PATCH] Fully embrace Ruby 1.9 hash syntax Didn't bother with files in db/, config/, or features/ --- app/contexts/commit_load.rb | 10 +- app/contexts/issues_bulk_update_context.rb | 6 +- app/controllers/admin/projects_controller.rb | 6 +- app/controllers/admin/users_controller.rb | 2 +- app/controllers/application_controller.rb | 14 +-- app/controllers/commits_controller.rb | 10 +- app/controllers/dashboard_controller.rb | 4 +- app/controllers/deploy_keys_controller.rb | 2 +- app/controllers/hooks_controller.rb | 2 +- app/controllers/issues_controller.rb | 28 ++--- app/controllers/keys_controller.rb | 2 +- app/controllers/merge_requests_controller.rb | 18 ++-- app/controllers/milestones_controller.rb | 6 +- app/controllers/notes_controller.rb | 6 +- app/controllers/profile_controller.rb | 2 +- app/controllers/projects_controller.rb | 10 +- .../protected_branches_controller.rb | 4 +- app/controllers/refs_controller.rb | 14 +-- app/controllers/search_controller.rb | 4 +- app/controllers/snippets_controller.rb | 16 +-- app/controllers/team_members_controller.rb | 4 +- app/controllers/wikis_controller.rb | 16 +-- app/decorators/application_decorator.rb | 2 +- app/decorators/event_decorator.rb | 2 +- app/decorators/tree_decorator.rb | 6 +- app/helpers/application_helper.rb | 30 +++--- app/helpers/gitlab_markdown_helper.rb | 20 ++-- app/helpers/issues_helper.rb | 4 +- app/helpers/merge_requests_helper.rb | 12 +-- app/helpers/tab_helper.rb | 4 +- app/mailers/notify.rb | 20 ++-- app/models/commit.rb | 12 +-- app/models/event.rb | 12 +-- app/models/issue.rb | 2 +- app/models/key.rb | 12 +-- app/models/merge_request.rb | 20 ++-- app/models/milestone.rb | 2 +- app/models/note.rb | 38 +++---- app/models/project.rb | 72 ++++++------- app/models/snippet.rb | 20 ++-- app/models/tree.rb | 2 +- app/models/user.rb | 72 ++++++------- app/models/users_project.rb | 10 +- app/models/wiki.rb | 6 +- app/observers/activity_observer.rb | 20 ++-- app/observers/mailer_observer.rb | 2 +- app/roles/account.rb | 4 +- app/roles/authority.rb | 26 ++--- app/roles/issue_commonality.rb | 28 ++--- app/roles/project_push.rb | 10 +- app/roles/ssh_key.rb | 2 +- app/roles/team.rb | 4 +- app/uploaders/attachment_uploader.rb | 4 +- app/views/admin/dashboard/index.html.haml | 8 +- app/views/admin/hooks/index.html.haml | 12 +-- app/views/admin/projects/_form.html.haml | 12 +-- app/views/admin/projects/edit.html.haml | 2 +- app/views/admin/projects/index.html.haml | 16 +-- app/views/admin/projects/new.html.haml | 2 +- app/views/admin/projects/show.html.haml | 20 ++-- app/views/admin/resque/show.html.haml | 2 +- app/views/admin/team_members/_form.html.haml | 8 +- app/views/admin/users/_form.html.haml | 20 ++-- app/views/admin/users/index.html.haml | 34 +++--- app/views/admin/users/show.html.haml | 22 ++-- app/views/commits/_commit.html.haml | 8 +- app/views/commits/_commit_box.html.haml | 6 +- app/views/commits/_diff_head.html.haml | 8 +- app/views/commits/_diffs.html.haml | 16 +-- app/views/commits/_head.html.haml | 16 +-- app/views/commits/_text_file.html.haml | 14 +-- app/views/commits/compare.html.haml | 10 +- app/views/commits/index.html.haml | 6 +- app/views/commits/index.js.haml | 2 +- app/views/commits/show.html.haml | 4 +- app/views/dashboard/index.html.haml | 18 ++-- app/views/dashboard/issues.html.haml | 4 +- app/views/dashboard/merge_requests.html.haml | 4 +- app/views/deploy_keys/_form.html.haml | 8 +- app/views/deploy_keys/_show.html.haml | 4 +- app/views/deploy_keys/index.html.haml | 4 +- app/views/deploy_keys/show.html.haml | 2 +- app/views/devise/passwords/edit.html.haml | 12 +-- app/views/errors/access_denied.html.haml | 2 +- app/views/events/_commit.html.haml | 6 +- app/views/events/_event.html.haml | 6 +- app/views/events/_event_issue.html.haml | 4 +- app/views/events/_event_last_push.html.haml | 8 +- .../events/_event_merge_request.html.haml | 4 +- app/views/events/_event_push.html.haml | 10 +- app/views/help/api.html.haml | 8 +- app/views/hooks/index.html.haml | 12 +-- app/views/issues/_form.html.haml | 22 ++-- app/views/issues/_head.html.haml | 12 +-- app/views/issues/_issues.html.haml | 4 +- app/views/issues/_show.html.haml | 16 +-- app/views/issues/create.js.haml | 2 +- app/views/issues/index.html.haml | 44 ++++---- app/views/issues/show.html.haml | 14 +-- .../kaminari/admin/_first_page.html.haml | 2 +- app/views/kaminari/admin/_last_page.html.haml | 2 +- app/views/kaminari/admin/_next_page.html.haml | 2 +- app/views/kaminari/admin/_page.html.haml | 4 +- app/views/kaminari/admin/_prev_page.html.haml | 4 +- .../kaminari/gitlab/_first_page.html.haml | 2 +- .../kaminari/gitlab/_last_page.html.haml | 2 +- .../kaminari/gitlab/_next_page.html.haml | 2 +- app/views/kaminari/gitlab/_page.html.haml | 4 +- .../kaminari/gitlab/_prev_page.html.haml | 2 +- app/views/keys/_form.html.haml | 6 +- app/views/keys/_show.html.haml | 2 +- app/views/keys/create.js.haml | 2 +- app/views/keys/index.html.haml | 6 +- app/views/keys/show.html.haml | 2 +- app/views/layouts/_app_menu.html.haml | 12 +-- app/views/layouts/_flash.html.haml | 2 +- app/views/layouts/_head.html.haml | 8 +- app/views/layouts/_head_panel.html.haml | 16 +-- app/views/layouts/_project_menu.html.haml | 18 ++-- app/views/layouts/admin.html.haml | 18 ++-- app/views/layouts/application.html.haml | 8 +- app/views/layouts/devise_layout.html.haml | 4 +- app/views/layouts/error.html.haml | 6 +- app/views/layouts/notify.html.haml | 28 ++--- app/views/layouts/profile.html.haml | 16 +-- app/views/layouts/project.html.haml | 8 +- app/views/merge_requests/_form.html.haml | 20 ++-- app/views/merge_requests/_head.html.haml | 2 +- .../merge_requests/_merge_request.html.haml | 6 +- app/views/merge_requests/_show.html.haml | 8 +- app/views/merge_requests/branch_from.js.haml | 2 +- app/views/merge_requests/branch_to.js.haml | 2 +- app/views/merge_requests/commits.js.haml | 2 +- app/views/merge_requests/diffs.js.haml | 2 +- app/views/merge_requests/index.html.haml | 20 ++-- app/views/merge_requests/show.js.haml | 2 +- .../merge_requests/show/_commits.html.haml | 6 +- .../merge_requests/show/_diffs.html.haml | 4 +- .../show/_how_to_merge.html.haml | 2 +- .../merge_requests/show/_mr_accept.html.haml | 16 +-- .../merge_requests/show/_mr_box.html.haml | 4 +- .../merge_requests/show/_mr_title.html.haml | 6 +- app/views/milestones/_form.html.haml | 22 ++-- app/views/milestones/_milestone.html.haml | 10 +- app/views/milestones/index.html.haml | 12 +-- app/views/milestones/show.html.haml | 12 +-- app/views/notes/_create_common.js.haml | 2 +- app/views/notes/_create_line.js.haml | 4 +- app/views/notes/_form.html.haml | 12 +-- app/views/notes/_load.js.haml | 6 +- app/views/notes/_notes_list.html.haml | 2 +- app/views/notes/_per_line_form.html.haml | 12 +-- app/views/notes/_per_line_show.html.haml | 4 +- app/views/notes/_reply_button.html.haml | 4 +- app/views/notes/_show.html.haml | 8 +- app/views/notes/create.js.haml | 4 +- app/views/notify/new_issue_email.html.haml | 20 ++-- .../notify/new_merge_request_email.html.haml | 22 ++-- app/views/notify/new_user_email.html.haml | 26 ++--- app/views/notify/note_commit_email.html.haml | 30 +++--- app/views/notify/note_issue_email.html.haml | 30 +++--- .../notify/note_merge_request_email.html.haml | 30 +++--- app/views/notify/note_wall_email.html.haml | 30 +++--- app/views/notify/note_wiki_email.html.haml | 30 +++--- .../notify/reassigned_issue_email.html.haml | 20 ++-- .../reassigned_merge_request_email.html.haml | 20 ++-- app/views/profile/design.html.haml | 10 +- app/views/profile/password.html.haml | 4 +- app/views/profile/show.html.haml | 34 +++--- app/views/profile/token.html.haml | 8 +- app/views/projects/_form.html.haml | 16 +-- app/views/projects/_new_form.html.haml | 10 +- app/views/projects/_project_head.html.haml | 24 ++--- app/views/projects/_refs.html.haml | 4 +- app/views/projects/_show.html.haml | 6 +- app/views/projects/_team.html.haml | 2 +- app/views/projects/create.js.haml | 2 +- app/views/projects/empty.html.haml | 4 +- app/views/projects/files.html.haml | 4 +- app/views/projects/show.html.haml | 14 +-- app/views/projects/team.html.haml | 6 +- app/views/projects/tree.js.haml | 2 +- app/views/projects/update.js.haml | 2 +- app/views/projects/wall.html.haml | 2 +- app/views/protected_branches/index.html.haml | 14 +-- app/views/refs/_head.html.haml | 6 +- app/views/refs/_submodule_item.html.haml | 6 +- app/views/refs/_tree.html.haml | 18 ++-- app/views/refs/_tree_commit.html.haml | 2 +- app/views/refs/_tree_file.html.haml | 14 +-- app/views/refs/_tree_item.html.haml | 6 +- app/views/refs/blame.html.haml | 12 +-- app/views/refs/logs_tree.js.haml | 2 +- app/views/refs/tree.html.haml | 2 +- app/views/refs/tree.js.haml | 2 +- app/views/repositories/_branch.html.haml | 12 +-- .../repositories/_branches_head.html.haml | 6 +- app/views/repositories/_feed.html.haml | 6 +- app/views/repositories/branches.html.haml | 2 +- app/views/repositories/show.html.haml | 2 +- app/views/repositories/tags.html.haml | 8 +- app/views/search/show.html.haml | 10 +- app/views/snippets/_form.html.haml | 14 +-- app/views/snippets/_snippet.html.haml | 4 +- app/views/snippets/index.html.haml | 4 +- app/views/snippets/show.html.haml | 8 +- app/views/team_members/_form.html.haml | 10 +- app/views/team_members/_show.html.haml | 14 +-- app/views/team_members/show.html.haml | 12 +-- app/views/wikis/_form.html.haml | 8 +- app/views/wikis/history.html.haml | 2 +- app/views/wikis/pages.html.haml | 2 +- app/views/wikis/show.html.haml | 10 +- lib/api.rb | 2 +- lib/api/entities.rb | 12 +-- lib/api/issues.rb | 32 +++--- lib/api/projects.rb | 32 +++--- lib/api/users.rb | 6 +- lib/file_size_validator.rb | 4 +- lib/gitlab/encode.rb | 2 +- lib/graph_commit.rb | 2 +- lib/redcarpet/render/gitlab_html.rb | 4 +- spec/api/issues_spec.rb | 8 +- spec/api/projects_spec.rb | 8 +- spec/helpers/gitlab_flavored_markdown_spec.rb | 100 +++++++++--------- spec/mailers/notify_spec.rb | 26 ++--- spec/models/activity_observer_spec.rb | 8 +- spec/models/event_spec.rb | 30 +++--- spec/models/issue_observer_spec.rb | 16 +-- spec/models/issue_spec.rb | 32 +++--- spec/models/merge_request_spec.rb | 16 +-- spec/models/milestone_spec.rb | 8 +- spec/models/note_spec.rb | 34 +++--- spec/models/project_hooks_spec.rb | 2 +- spec/models/project_security_spec.rb | 8 +- spec/models/project_spec.rb | 20 ++-- spec/models/protected_branch_spec.rb | 4 +- spec/models/system_hook_spec.rb | 2 +- spec/models/user_spec.rb | 14 +-- spec/requests/admin/admin_hooks_spec.rb | 6 +- spec/requests/admin/admin_projects_spec.rb | 16 +-- spec/requests/admin/admin_users_spec.rb | 16 +-- spec/requests/atom/dashboard_issues_spec.rb | 34 +++--- spec/requests/atom/dashboard_spec.rb | 6 +- spec/requests/atom/issues_spec.rb | 20 ++-- .../requests/gitlab_flavored_markdown_spec.rb | 80 +++++++------- spec/requests/hooks_spec.rb | 6 +- spec/requests/issues_spec.rb | 30 +++--- spec/requests/projects_deploy_keys_spec.rb | 8 +- spec/requests/projects_spec.rb | 8 +- spec/requests/search_spec.rb | 2 +- spec/requests/security/project_access_spec.rb | 6 +- spec/requests/snippets_spec.rb | 20 ++-- spec/spec_helper.rb | 6 +- spec/support/login.rb | 18 ++-- spec/support/valid_commit.rb | 2 +- spec/workers/post_receive_spec.rb | 2 +- 257 files changed, 1449 insertions(+), 1449 deletions(-) diff --git a/app/contexts/commit_load.rb b/app/contexts/commit_load.rb index bab30d61..f57c4969 100644 --- a/app/contexts/commit_load.rb +++ b/app/contexts/commit_load.rb @@ -1,11 +1,11 @@ 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]) diff --git a/app/contexts/issues_bulk_update_context.rb b/app/contexts/issues_bulk_update_context.rb index 0ba779de..7c3c1d4f 100644 --- a/app/contexts/issues_bulk_update_context.rb +++ b/app/contexts/issues_bulk_update_context.rb @@ -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 diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 17009946..80d11f03 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -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 diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 4b123e4f..1e8f420b 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7ea9f320..7c1941ec 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 05f29da3..861fc324 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -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 diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 8508e245..7696e97a 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -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 diff --git a/app/controllers/deploy_keys_controller.rb b/app/controllers/deploy_keys_controller.rb index 9d4e0483..82c10512 100644 --- a/app/controllers/deploy_keys_controller.rb +++ b/app/controllers/deploy_keys_controller.rb @@ -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 diff --git a/app/controllers/hooks_controller.rb b/app/controllers/hooks_controller.rb index df22b0ba..c81e6b05 100644 --- a/app/controllers/hooks_controller.rb +++ b/app/controllers/hooks_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 85333b85..a7958b1e 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/controllers/keys_controller.rb b/app/controllers/keys_controller.rb index ce49e3e7..1a25d834 100644 --- a/app/controllers/keys_controller.rb +++ b/app/controllers/keys_controller.rb @@ -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 diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index f9a1c1dd..4938a294 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -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 diff --git a/app/controllers/milestones_controller.rb b/app/controllers/milestones_controller.rb index 1f2490cb..7acb3781 100644 --- a/app/controllers/milestones_controller.rb +++ b/app/controllers/milestones_controller.rb @@ -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 diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 8fac6428..f003ea7b 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -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 diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 0322a039..a95a3310 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 26b62cba..b596a5a6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,14 +1,14 @@ 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" } diff --git a/app/controllers/protected_branches_controller.rb b/app/controllers/protected_branches_controller.rb index 0b86f525..78c9c9ef 100644 --- a/app/controllers/protected_branches_controller.rb +++ b/app/controllers/protected_branches_controller.rb @@ -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 diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index a261f2a8..3f81a2ca 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -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) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 30bcb49b..71e2d92b 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -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 diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 3d56bebe..f852e425 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,7 +1,7 @@ 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 diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index ab51c19e..0cc58c3e 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -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 diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index 993abcf8..55ccfe72 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -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" } diff --git a/app/decorators/application_decorator.rb b/app/decorators/application_decorator.rb index 8c35cae9..7bc88648 100644 --- a/app/decorators/application_decorator.rb +++ b/app/decorators/application_decorator.rb @@ -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 diff --git a/app/decorators/event_decorator.rb b/app/decorators/event_decorator.rb index 50aaa615..7df9081f 100644 --- a/app/decorators/event_decorator.rb +++ b/app/decorators/event_decorator.rb @@ -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 diff --git a/app/decorators/tree_decorator.rb b/app/decorators/tree_decorator.rb index 2b82a425..80c48da7 100644 --- a/app/decorators/tree_decorator.rb +++ b/app/decorators/tree_decorator.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e1aa14c9..7a9f0e9d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index f839ee55..89fc04a2 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -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 diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 0982aacc..177ba0c2 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -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 diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index f9bfc8cd..62ac5e55 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -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 diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index fa5ca166..1740864b 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -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 diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 7a2fd3d6..9563fdbc 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -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 diff --git a/app/models/commit.rb b/app/models/commit.rb index 71c41350..5c6b4d88 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -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 diff --git a/app/models/event.rb b/app/models/event.rb index c75924e7..e20b79e2 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -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 # diff --git a/app/models/issue.rb b/app/models/issue.rb index d8ca59c2..454b1358 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -7,7 +7,7 @@ class Issue < ActiveRecord::Base belongs_to :milestone validates :description, - :length => { :within => 0..2000 } + length: { within: 0..2000 } acts_as_list diff --git a/app/models/key.rb b/app/models/key.rb index 6b90b315..cfcb1f63 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -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.' diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index a77081c9..47966d66 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 7fdfe29e..592c57f9 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -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 diff --git a/app/models/note.rb b/app/models/note.rb index 8a26cd05..711a4ee6 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index 3ab44bdf..de1911f1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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? diff --git a/app/models/snippet.rb b/app/models/snippet.rb index e5f04bb2..2c941499 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -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]) diff --git a/app/models/tree.rb b/app/models/tree.rb index 9d60f830..bc95d335 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -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, diff --git a/app/models/user.rb b/app/models/user.rb index ff27660a..92c81c83 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/models/users_project.rb b/app/models/users_project.rb index 4ff86290..36e6d904 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -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 diff --git a/app/models/wiki.rb b/app/models/wiki.rb index d9ec069d..3c4952cd 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -1,10 +1,10 @@ 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 diff --git a/app/observers/activity_observer.rb b/app/observers/activity_observer.rb index 324d8207..48351bac 100644 --- a/app/observers/activity_observer.rb +++ b/app/observers/activity_observer.rb @@ -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 diff --git a/app/observers/mailer_observer.rb b/app/observers/mailer_observer.rb index b6f52178..331aaa35 100644 --- a/app/observers/mailer_observer.rb +++ b/app/observers/mailer_observer.rb @@ -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() diff --git a/app/roles/account.rb b/app/roles/account.rb index e77cbe6c..63a9b5c5 100644 --- a/app/roles/account.rb +++ b/app/roles/account.rb @@ -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 diff --git a/app/roles/authority.rb b/app/roles/authority.rb index a03b54a3..9d9153db 100644 --- a/app/roles/authority.rb +++ b/app/roles/authority.rb @@ -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 diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb index 353d6a5c..a8fd679d 100644 --- a/app/roles/issue_commonality.rb +++ b/app/roles/issue_commonality.rb @@ -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 diff --git a/app/roles/project_push.rb b/app/roles/project_push.rb index 44e97b45..02025384 100644 --- a/app/roles/project_push.rb +++ b/app/roles/project_push.rb @@ -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) } diff --git a/app/roles/ssh_key.rb b/app/roles/ssh_key.rb index f1143c5d..5e1d2c23 100644 --- a/app/roles/ssh_key.rb +++ b/app/roles/ssh_key.rb @@ -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) diff --git a/app/roles/team.rb b/app/roles/team.rb index bf3a6702..27b1cc65 100644 --- a/app/roles/team.rb +++ b/app/roles/team.rb @@ -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 diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 4ba19ace..bb7dc0da 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -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. diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index 886943be..2e67abfc 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -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 diff --git a/app/views/admin/hooks/index.html.haml b/app/views/admin/hooks/index.html.haml index 030e6136..d34acffe 100644 --- a/app/views/admin/hooks/index.html.haml +++ b/app/views/admin/hooks/index.html.haml @@ -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"   - = 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" diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml index 4217defb..7cebddf2 100644 --- a/app/views/admin/projects/_form.html.haml +++ b/app/views/admin/projects/_form.html.haml @@ -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" diff --git a/app/views/admin/projects/edit.html.haml b/app/views/admin/projects/edit.html.haml index 826615f3..b5255671 100644 --- a/app/views/admin/projects/edit.html.haml +++ b/app/views/admin/projects/edit.html.haml @@ -1,3 +1,3 @@ %h3.page_title #{@admin_project.name} → Edit project %hr -= render 'form', :project => @admin_project += render 'form', project: @admin_project diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 7218eebb..4512bb7e 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,10 +1,10 @@ %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" diff --git a/app/views/admin/projects/new.html.haml b/app/views/admin/projects/new.html.haml index eadb1f88..ac6526bf 100644 --- a/app/views/admin/projects/new.html.haml +++ b/app/views/admin/projects/new.html.haml @@ -1,3 +1,3 @@ %h3.page_title New project %hr -= render 'form', :project => @admin_project += render 'form', project: @admin_project diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 4898d32e..5ed56477 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -1,6 +1,6 @@ %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 { diff --git a/app/views/admin/resque/show.html.haml b/app/views/admin/resque/show.html.haml index 26712953..0375d94b 100644 --- a/app/views/admin/resque/show.html.haml +++ b/app/views/admin/resque/show.html.haml @@ -1,2 +1,2 @@ %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 diff --git a/app/views/admin/team_members/_form.html.haml b/app/views/admin/team_members/_form.html.haml index 03475762..6a128de9 100644 --- a/app/views/admin/team_members/_form.html.haml +++ b/app/views/admin/team_members/_form.html.haml @@ -1,4 +1,4 @@ -= 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 { diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index c1955b32..5e68a23f 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -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 & 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" diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 5d5320db..5edca312 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -1,22 +1,22 @@ %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" diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 7510b144..4cca8ed7 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -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 { diff --git a/app/views/commits/_commit.html.haml b/app/views/commits/_commit.html.haml index b4f8f91f..686a4337 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/commits/_commit.html.haml @@ -1,13 +1,13 @@ %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 – - = 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) diff --git a/app/views/commits/_commit_box.html.haml b/app/views/commits/_commit_box.html.haml index 5edaaf9b..52f03ba7 100644 --- a/app/views/commits/_commit_box.html.haml +++ b/app/views/commits/_commit_box.html.haml @@ -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 diff --git a/app/views/commits/_diff_head.html.haml b/app/views/commits/_diff_head.html.haml index 11d6ca16..710e8857 100644 --- a/app/views/commits/_diff_head.html.haml +++ b/app/views/commits/_diff_head.html.haml @@ -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" diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index d51561d9..b590d64c 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -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 diff --git a/app/views/commits/_head.html.haml b/app/views/commits/_head.html.haml index 453ca4ea..a211329f 100644 --- a/app/views/commits/_head.html.haml +++ b/app/views/commits/_head.html.haml @@ -1,21 +1,21 @@ %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(){ diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml index cab06641..0f6210f2 100644 --- a/app/views/commits/_text_file.html.haml +++ b/app/views/commits/_text_file.html.haml @@ -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" ? " " : line_old), "##{line_code}", :id => line_code + = link_to raw(type == "new" ? " " : 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" ? " " : line_new) , "##{line_code}", :id => line_code - %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " + = link_to "", "#", class: "line_note_link", "line_code" => line_code, title: "Add note for this line" + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " - 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 } diff --git a/app/views/commits/compare.html.haml b/app/views/commits/compare.html.haml index 04d8af54..be915cd1 100644 --- a/app/views/commits/compare.html.haml +++ b/app/views/commits/compare.html.haml @@ -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() { diff --git a/app/views/commits/index.html.haml b/app/views/commits/index.html.haml index 385b4357..11ffdb6a 100644 --- a/app/views/commits/index.html.haml +++ b/app/views/commits/index.html.haml @@ -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 diff --git a/app/views/commits/index.js.haml b/app/views/commits/index.js.haml index 39b7108c..797bc14c 100644 --- a/app/views/commits/index.js.haml +++ b/app/views/commits/index.js.haml @@ -1,3 +1,3 @@ :plain - CommitsList.append(#{@commits.count}, "#{escape_javascript(render(:partial => 'commits/commits'))}"); + CommitsList.append(#{@commits.count}, "#{escape_javascript(render(partial: 'commits/commits'))}"); diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 7119bd04..9a483aa2 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -1,6 +1,6 @@ = 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" diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index e1d77819..9fea5acb 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -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 → - .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 diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 5b20bffe..cc488d57 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -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 diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 11176102..23a7e722 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -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 diff --git a/app/views/deploy_keys/_form.html.haml b/app/views/deploy_keys/_form.html.haml index 2aa57cdc..461f1f5d 100644 --- a/app/views/deploy_keys/_form.html.haml +++ b/app/views/deploy_keys/_form.html.haml @@ -1,5 +1,5 @@ %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" diff --git a/app/views/deploy_keys/_show.html.haml b/app/views/deploy_keys/_show.html.haml index ff17b3cd..a5314ae9 100644 --- a/app/views/deploy_keys/_show.html.haml +++ b/app/views/deploy_keys/_show.html.haml @@ -1,6 +1,6 @@ %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" diff --git a/app/views/deploy_keys/index.html.haml b/app/views/deploy_keys/index.html.haml index 19899de3..0ee9d03b 100644 --- a/app/views/deploy_keys/index.html.haml +++ b/app/views/deploy_keys/index.html.haml @@ -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}) diff --git a/app/views/deploy_keys/show.html.haml b/app/views/deploy_keys/show.html.haml index 16c441be..b1e0dc5c 100644 --- a/app/views/deploy_keys/show.html.haml +++ b/app/views/deploy_keys/show.html.haml @@ -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 diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index dfd715ac..31d35567 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,12 +1,12 @@ -= 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" diff --git a/app/views/errors/access_denied.html.haml b/app/views/errors/access_denied.html.haml index 718663db..644ee03e 100644 --- a/app/views/errors/access_denied.html.haml +++ b/app/views/errors/access_denied.html.haml @@ -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"} diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index ca0f29e2..15f3bb5a 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -1,9 +1,9 @@ - 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 – - = 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" diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index b3db83c2..d49f0382 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -1,13 +1,13 @@ - 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 diff --git a/app/views/events/_event_issue.html.haml b/app/views/events/_event_issue.html.haml index 4293be82..4d357b7f 100644 --- a/app/views/events/_event_issue.html.haml +++ b/app/views/events/_event_issue.html.haml @@ -1,6 +1,6 @@ -= 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 diff --git a/app/views/events/_event_last_push.html.haml b/app/views/events/_event_last_push.html.haml index 212ef817..4ef92749 100644 --- a/app/views/events/_event_last_push.html.haml +++ b/app/views/events/_event_last_push.html.haml @@ -1,13 +1,13 @@ - 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 diff --git a/app/views/events/_event_merge_request.html.haml b/app/views/events/_event_merge_request.html.haml index 774921a7..ceb39371 100644 --- a/app/views/events/_event_merge_request.html.haml +++ b/app/views/events/_event_merge_request.html.haml @@ -1,8 +1,8 @@ - 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 diff --git a/app/views/events/_event_push.html.haml b/app/views/events/_event_push.html.haml index 59d8962b..0adcaf9d 100644 --- a/app/views/events/_event_push.html.haml +++ b/app/views/events/_event_push.html.haml @@ -1,10 +1,10 @@ %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 diff --git a/app/views/help/api.html.haml b/app/views/help/api.html.haml index e184df54..344f8ade 100644 --- a/app/views/help/api.html.haml +++ b/app/views/help/api.html.haml @@ -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 diff --git a/app/views/hooks/index.html.haml b/app/views/hooks/index.html.haml index 15699fc4..4e15dc50 100644 --- a/app/views/hooks/index.html.haml +++ b/app/views/hooks/index.html.haml @@ -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"   - = 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" diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index 4f6f8396..6139f3d4 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -1,6 +1,6 @@ %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" diff --git a/app/views/issues/_head.html.haml b/app/views/issues/_head.html.haml index 701b0625..1f6e7d7f 100644 --- a/app/views/issues/_head.html.haml +++ b/app/views/issues/_head.html.haml @@ -1,11 +1,11 @@ %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" diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index fc515ec3..f82ae8bd 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -1,10 +1,10 @@ - @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} diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index ed27bddd..8500cd40 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -1,7 +1,7 @@ -%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}" diff --git a/app/views/issues/create.js.haml b/app/views/issues/create.js.haml index abf3f6b8..d90cbf0d 100644 --- a/app/views/issues/create.js.haml +++ b/app/views/issues/create.js.haml @@ -1,7 +1,7 @@ - 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 diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index 27eff501..f3c743f7 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -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   .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 diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index c653377a..dce8cf6a 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -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" diff --git a/app/views/kaminari/admin/_first_page.html.haml b/app/views/kaminari/admin/_first_page.html.haml index fee8112f..41c9c0b3 100644 --- a/app/views/kaminari/admin/_first_page.html.haml +++ b/app/views/kaminari/admin/_first_page.html.haml @@ -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 diff --git a/app/views/kaminari/admin/_last_page.html.haml b/app/views/kaminari/admin/_last_page.html.haml index 6e41d232..b03a2062 100644 --- a/app/views/kaminari/admin/_last_page.html.haml +++ b/app/views/kaminari/admin/_last_page.html.haml @@ -6,4 +6,4 @@ -# per_page: number of items to fetch per page -# remote: data-remote %span.last - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} + = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote} diff --git a/app/views/kaminari/admin/_next_page.html.haml b/app/views/kaminari/admin/_next_page.html.haml index 76f40e72..00c5f0b6 100644 --- a/app/views/kaminari/admin/_next_page.html.haml +++ b/app/views/kaminari/admin/_next_page.html.haml @@ -6,4 +6,4 @@ -# per_page: number of items to fetch per page -# remote: data-remote %li.next - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote + = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote diff --git a/app/views/kaminari/admin/_page.html.haml b/app/views/kaminari/admin/_page.html.haml index 59668129..a52d883b 100644 --- a/app/views/kaminari/admin/_page.html.haml +++ b/app/views/kaminari/admin/_page.html.haml @@ -6,5 +6,5 @@ -# num_pages: total number of pages -# per_page: number of items to fetch per page -# remote: data-remote -%li{:class => "page#{' active' if page.current?}"} - = link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} +%li{class: "page#{' active' if page.current?}"} + = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} diff --git a/app/views/kaminari/admin/_prev_page.html.haml b/app/views/kaminari/admin/_prev_page.html.haml index cef885ee..f673abdb 100644 --- a/app/views/kaminari/admin/_prev_page.html.haml +++ b/app/views/kaminari/admin/_prev_page.html.haml @@ -5,5 +5,5 @@ -# num_pages: total number of pages -# per_page: number of items to fetch per page -# remote: data-remote -%li{:class => "prev" } - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote +%li{class: "prev" } + = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote diff --git a/app/views/kaminari/gitlab/_first_page.html.haml b/app/views/kaminari/gitlab/_first_page.html.haml index fee8112f..41c9c0b3 100644 --- a/app/views/kaminari/gitlab/_first_page.html.haml +++ b/app/views/kaminari/gitlab/_first_page.html.haml @@ -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 diff --git a/app/views/kaminari/gitlab/_last_page.html.haml b/app/views/kaminari/gitlab/_last_page.html.haml index 6e41d232..b03a2062 100644 --- a/app/views/kaminari/gitlab/_last_page.html.haml +++ b/app/views/kaminari/gitlab/_last_page.html.haml @@ -6,4 +6,4 @@ -# per_page: number of items to fetch per page -# remote: data-remote %span.last - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} + = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote} diff --git a/app/views/kaminari/gitlab/_next_page.html.haml b/app/views/kaminari/gitlab/_next_page.html.haml index e87ab4e0..296cceb0 100644 --- a/app/views/kaminari/gitlab/_next_page.html.haml +++ b/app/views/kaminari/gitlab/_next_page.html.haml @@ -6,4 +6,4 @@ -# per_page: number of items to fetch per page -# remote: data-remote %span.next - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote + = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote diff --git a/app/views/kaminari/gitlab/_page.html.haml b/app/views/kaminari/gitlab/_page.html.haml index 528bba8f..19456dcc 100644 --- a/app/views/kaminari/gitlab/_page.html.haml +++ b/app/views/kaminari/gitlab/_page.html.haml @@ -6,5 +6,5 @@ -# num_pages: total number of pages -# per_page: number of items to fetch per page -# remote: data-remote -%span{:class => "page#{' current' if page.current?}"} - = link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} +%span{class: "page#{' current' if page.current?}"} + = link_to_unless page.current?, page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} diff --git a/app/views/kaminari/gitlab/_prev_page.html.haml b/app/views/kaminari/gitlab/_prev_page.html.haml index 13f0d8ad..5c206169 100644 --- a/app/views/kaminari/gitlab/_prev_page.html.haml +++ b/app/views/kaminari/gitlab/_prev_page.html.haml @@ -6,4 +6,4 @@ -# per_page: number of items to fetch per page -# remote: data-remote %span.prev - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote + = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote diff --git a/app/views/keys/_form.html.haml b/app/views/keys/_form.html.haml index c25e8d07..ee2eafdd 100644 --- a/app/views/keys/_form.html.haml +++ b/app/views/keys/_form.html.haml @@ -11,8 +11,8 @@ .input= f.text_field :title .clearfix = f.label :key - .input= f.text_area :key, :class => [:xxlarge, :thin_area] + .input= f.text_area :key, class: [:xxlarge, :thin_area] .actions - = f.submit 'Save', :class => "primary btn" - = link_to "Cancel", keys_path, :class => "btn" + = f.submit 'Save', class: "primary btn" + = link_to "Cancel", keys_path, class: "btn" diff --git a/app/views/keys/_show.html.haml b/app/views/keys/_show.html.haml index 7035e609..a0af8eea 100644 --- a/app/views/keys/_show.html.haml +++ b/app/views/keys/_show.html.haml @@ -9,5 +9,5 @@ = time_ago_in_words(key.created_at) ago %td - = link_to 'Remove', key, :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger delete-key right" + = link_to 'Remove', key, confirm: 'Are you sure?', method: :delete, class: "btn small danger delete-key right" diff --git a/app/views/keys/create.js.haml b/app/views/keys/create.js.haml index b0d7f528..1dccf6fd 100644 --- a/app/views/keys/create.js.haml +++ b/app/views/keys/create.js.haml @@ -1,7 +1,7 @@ - if @key.valid? :plain $("#new_key_dialog").dialog("close"); - $("#keys-table .data").append("#{escape_javascript(render(:partial => 'show', :locals => {:key => @key}))}"); + $("#keys-table .data").append("#{escape_javascript(render(partial: 'show', locals: {key: @key}))}"); $("#no_ssh_key_defined").hide(); - else :plain diff --git a/app/views/keys/index.html.haml b/app/views/keys/index.html.haml index 35cda178..04e9e4cb 100644 --- a/app/views/keys/index.html.haml +++ b/app/views/keys/index.html.haml @@ -1,6 +1,6 @@ %h3.page_title SSH Keys - = link_to "Add new", new_key_path, :class => "btn small right" + = link_to "Add new", new_key_path, class: "btn small right" %hr %p.slead @@ -14,9 +14,9 @@ %th Added %th - @keys.each do |key| - = render(:partial => 'show', :locals => {:key => key}) + = render(partial: 'show', locals: {key: key}) - if @keys.blank? %tr - %td{:colspan => 3} + %td{colspan: 3} %h3.nothing_here_message There are no SSH keys with access to your account. diff --git a/app/views/keys/show.html.haml b/app/views/keys/show.html.haml index 79f51257..ffd52b96 100644 --- a/app/views/keys/show.html.haml +++ b/app/views/keys/show.html.haml @@ -11,4 +11,4 @@ %pre= @key.key .actions - = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => "btn danger delete-key" + = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key" diff --git a/app/views/layouts/_app_menu.html.haml b/app/views/layouts/_app_menu.html.haml index 6575ee99..02531489 100644 --- a/app/views/layouts/_app_menu.html.haml +++ b/app/views/layouts/_app_menu.html.haml @@ -1,19 +1,19 @@ %ul.main_menu - %li.home{:class => tab_class(:root)} - = link_to "Home", root_path, :title => "Home" + %li.home{class: tab_class(:root)} + = link_to "Home", root_path, title: "Home" - %li{:class => tab_class(:dash_issues)} + %li{class: tab_class(:dash_issues)} = link_to dashboard_issues_path do Issues %span.count= current_user.assigned_issues.opened.count - %li{:class => tab_class(:dash_mr)} + %li{class: tab_class(:dash_mr)} = link_to dashboard_merge_requests_path do Merge Requests %span.count= current_user.cared_merge_requests.count - %li{:class => tab_class(:search)} + %li{class: tab_class(:search)} = link_to "Search", search_path - %li{:class => tab_class(:help)} + %li{class: tab_class(:help)} = link_to "Help", help_path diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index 2e40f0a6..86564ad7 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -1,6 +1,6 @@ - if alert || notice - text = alert || notice - %div{:style => "display:none", :id => "flash_container"} + %div{style: "display:none", id: "flash_container"} %center %h4= text :javascript diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index e609557b..3a2586a3 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -1,5 +1,5 @@ %head - %meta{:charset => "utf-8"} + %meta{charset: "utf-8"} %title GitLab = " > #{@project.name}" if @project && !@project.new_record? @@ -9,10 +9,10 @@ -# Atom feed - if controller_name == 'projects' && action_name == 'index' - = auto_discovery_link_tag :atom, projects_url(:atom, :private_token => current_user.private_token), :title => "Dashboard feed" + = auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed" - if @project && !@project.new_record? - if current_page?(tree_project_ref_path(@project, @project.root_ref)) || current_page?(project_commits_path(@project)) - = auto_discovery_link_tag(:atom, project_commits_url(@project, :atom, :ref => @ref, :private_token => current_user.private_token), :title => "Recent commits to #{@project.name}:#{@ref}") + = auto_discovery_link_tag(:atom, project_commits_url(@project, :atom, ref: @ref, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}") - if request.path == project_issues_path(@project) - = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, :private_token => current_user.private_token), :title => "#{@project.name} issues") + = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") = csrf_meta_tags diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 9e019021..d6247d36 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -3,30 +3,30 @@ .container .top_panel_content %div.app_logo - = link_to root_path, :class => "home", :title => "Home" do + = link_to root_path, class: "home", title: "Home" do %h1 GITLAB %span.separator %h1.project_name= title .search - = form_tag search_path, :method => :get do |f| - = text_field_tag "search", nil, :placeholder => "Search", :class => "search-input" + = form_tag search_path, method: :get do |f| + = text_field_tag "search", nil, placeholder: "Search", class: "search-input" .fbtn - if current_user.is_admin? - = link_to admin_root_path, :class => "btn small", :title => "Admin area" do + = link_to admin_root_path, class: "btn small", title: "Admin area" do %i.icon-cog Admin - if current_user.can_create_project? - = link_to new_project_path, :class => "btn small", :title => "Create New Project" do + = link_to new_project_path, class: "btn small", title: "Create New Project" do %i.icon-plus Project .account-box - = link_to profile_path, :class => "pic" do + = link_to profile_path, class: "pic" do = image_tag gravatar_icon(current_user.email) .account-links - = link_to profile_path, :class => "username" do + = link_to profile_path, class: "username" do My profile - = link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete + = link_to 'Logout', destroy_user_session_path, class: "logout", method: :delete :javascript $(function(){ diff --git a/app/views/layouts/_project_menu.html.haml b/app/views/layouts/_project_menu.html.haml index 3f58fc5a..04eaec5a 100644 --- a/app/views/layouts/_project_menu.html.haml +++ b/app/views/layouts/_project_menu.html.haml @@ -1,37 +1,37 @@ %ul.main_menu - %li.home{:class => project_tab_class} - = link_to @project.code, project_path(@project), :title => "Project" + %li.home{class: project_tab_class} + = link_to @project.code, project_path(@project), title: "Project" - if @project.repo_exists? - if can? current_user, :download_code, @project - %li{:class => tree_tab_class} + %li{class: tree_tab_class} = link_to tree_project_ref_path(@project, @project.root_ref) do Files - %li{:class => commit_tab_class} + %li{class: commit_tab_class} = link_to "Commits", project_commits_path(@project) - %li{:class => tab_class(:network)} + %li{class: tab_class(:network)} = link_to "Network", graph_project_path(@project) - if @project.issues_enabled - %li{:class => tab_class(:issues)} + %li{class: tab_class(:issues)} = link_to project_issues_filter_path(@project) do Issues %span.count.issue_counter= @project.issues.opened.count - if @project.repo_exists? - if @project.merge_requests_enabled - %li{:class => tab_class(:merge_requests)} + %li{class: tab_class(:merge_requests)} = link_to project_merge_requests_path(@project) do Merge Requests %span.count.merge_counter= @project.merge_requests.opened.count - if @project.wall_enabled - %li{:class => tab_class(:wall)} + %li{class: tab_class(:wall)} = link_to wall_project_path(@project) do Wall - if @project.wiki_enabled - %li{:class => tab_class(:wiki)} + %li{class: tab_class(:wiki)} = link_to project_wiki_path(@project, :index) do Wiki diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 69304ede..fa4ec6c9 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -1,22 +1,22 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" - %body{:class => "#{app_theme} admin"} + %body{class: "#{app_theme} admin"} = render "layouts/flash" - = render "layouts/head_panel", :title => "Admin area" + = render "layouts/head_panel", title: "Admin area" .container %ul.main_menu - %li.home{:class => tab_class(:admin_root)} + %li.home{class: tab_class(:admin_root)} = link_to "Stats", admin_root_path - %li{:class => tab_class(:admin_projects)} + %li{class: tab_class(:admin_projects)} = link_to "Projects", admin_projects_path - %li{:class => tab_class(:admin_users)} + %li{class: tab_class(:admin_users)} = link_to "Users", admin_users_path - %li{:class => tab_class(:admin_logs)} + %li{class: tab_class(:admin_logs)} = link_to "Logs", admin_logs_path - %li{:class => tab_class(:admin_emails)} + %li{class: tab_class(:admin_emails)} = link_to "Hooks", admin_hooks_path - %li{:class => tab_class(:admin_resque)} + %li{class: tab_class(:admin_resque)} = link_to "Resque", admin_resque_path .content= yield diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0d5d829e..dda10d5d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,10 +1,10 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" - %body{:class => "#{app_theme} application"} + %body{class: "#{app_theme} application"} = render "layouts/flash" - = render "layouts/head_panel", :title => "Dashboard" + = render "layouts/head_panel", title: "Dashboard" .container - = render :partial => "layouts/app_menu" + = render partial: "layouts/app_menu" .content = yield diff --git a/app/views/layouts/devise_layout.html.haml b/app/views/layouts/devise_layout.html.haml index c293734b..70c4f007 100644 --- a/app/views/layouts/devise_layout.html.haml +++ b/app/views/layouts/devise_layout.html.haml @@ -1,6 +1,6 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" %body.ui_basic.login-page - = render :partial => "layouts/flash" + = render partial: "layouts/flash" .container= yield diff --git a/app/views/layouts/error.html.haml b/app/views/layouts/error.html.haml index 943dbe77..a512c4a5 100644 --- a/app/views/layouts/error.html.haml +++ b/app/views/layouts/error.html.haml @@ -1,9 +1,9 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" - %body{:class => "#{app_theme} application"} + %body{class: "#{app_theme} application"} = render "layouts/flash" - = render "layouts/head_panel", :title => "" + = render "layouts/head_panel", title: "" .container .content %br diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index bebcf82d..a1938df4 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -1,6 +1,6 @@ -%html{:lang => "en"} +%html{lang: "en"} %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"} + %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} %title gitlabhq :css @@ -11,28 +11,28 @@ .content a {color: #0eb6ce; text-decoration: none;} .footer p {font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;} .footer a {color: #0eb6ce; text-decoration: none;} - %body{:bgcolor => "#EAEAEA", :style => "margin: 0; padding: 0; background: #EAEAEA"} - %table{:align => "center", :border => "0", :cellpadding => "0", :cellspacing => "0", :style => "padding: 35px 0; background: #EAEAEA;", :width => "100%"} + %body{bgcolor: "#EAEAEA", style: "margin: 0; padding: 0; background: #EAEAEA"} + %table{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "padding: 35px 0; background: #EAEAEA;", width: "100%"} %tr - %td{:align => "center", :style => "margin: 0; padding: 0; background: #EAEAEA;"} - %table.header{:align => "center", :border => "0", :cellpadding => "0", :cellspacing => "0", :style => "font-family: Helvetica, Arial, sans-serif; background:#333", :width => "600"} + %td{align: "center", style: "margin: 0; padding: 0; background: #EAEAEA;"} + %table.header{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background:#333", width: "600"} %tr - %td{:style => "font-size: 0px;", :width => "20"} + %td{style: "font-size: 0px;", width: "20"} \  - %td{:align => "left", :style => "padding: 18px 0 10px;", :width => "580"} - %h1{:style => "color: #BBBBBB; font: normal 32px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 40px;"} + %td{align: "left", style: "padding: 18px 0 10px;", width: "580"} + %h1{style: "color: #BBBBBB; font: normal 32px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 40px;"} gitlab - if @project | #{@project.name} - %table{:align => "center", :bgcolor => "#fff", :border => "0", :cellpadding => "0", :cellspacing => "0", :style => "font-family: Helvetica, Arial, sans-serif; background: #fff;", :width => "600"} + %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"} %tr= yield %tr - %td{:align => "left", :colspan => "2", :height => "3", :style => "padding: font-size: 0; line-height: 0; height: 3px;", :width => "600"} - %table.footer{:align => "center", :border => "0", :cellpadding => "0", :cellspacing => "0", :style => "font-family: Helvetica, Arial, sans-serif; line-height: 10px;", :width => "600"} + %td{align: "left", colspan: "2", height: "3", style: "padding: font-size: 0; line-height: 0; height: 3px;", width: "600"} + %table.footer{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; line-height: 10px;", width: "600"} %tr - %td{:align => "center", :style => "padding: 5px 0 10px; font-size: 11px; color:#7d7a7a; margin: 0; line-height: 1.2;font-family: Helvetica, Arial, sans-serif;", :valign => "top"} + %td{align: "center", style: "padding: 5px 0 10px; font-size: 11px; color:#7d7a7a; margin: 0; line-height: 1.2;font-family: Helvetica, Arial, sans-serif;", valign: "top"} %br - %p{:style => "font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;"} + %p{style: "font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;"} You're receiving this notification because you are a member of the - if @project #{@project.name} diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index 957a68bf..b624415d 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -1,26 +1,26 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" - %body{:class => "#{app_theme} profile"} + %body{class: "#{app_theme} profile"} = render "layouts/flash" - = render "layouts/head_panel", :title => "Profile" + = render "layouts/head_panel", title: "Profile" .container %ul.main_menu - %li.home{:class => tab_class(:profile)} + %li.home{class: tab_class(:profile)} = link_to "Profile", profile_path - %li{:class => tab_class(:password)} + %li{class: tab_class(:password)} = link_to "Password", profile_password_path - %li{:class => tab_class(:ssh_keys)} + %li{class: tab_class(:ssh_keys)} = link_to keys_path do SSH Keys %span.count= current_user.keys.count - %li{:class => tab_class(:token)} + %li{class: tab_class(:token)} = link_to "Token", profile_token_path - %li{:class => tab_class(:design)} + %li{class: tab_class(:design)} = link_to "Design", profile_design_path diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index d9843c65..56a947d2 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -1,11 +1,11 @@ !!! 5 -%html{ :lang => "en"} +%html{ lang: "en"} = render "layouts/head" - %body{:class => "#{app_theme} project"} + %body{class: "#{app_theme} project"} = render "layouts/flash" - = render "layouts/head_panel", :title => @project.name + = render "layouts/head_panel", title: @project.name .container - = render :partial => "layouts/project_menu" + = render partial: "layouts/project_menu" .content = yield diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml index 4f20a06f..b6c12397 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @merge_request], :html => { :class => "new_merge_request form-horizontal" } do |f| += form_for [@project, @merge_request], html: { class: "new_merge_request form-horizontal" } do |f| -if @merge_request.errors.any? .alert-message.block-message.error %ul @@ -14,9 +14,9 @@ %h5 From (Head Branch) .body .padded - = f.label :source_branch, "From", :class => "control-label" + = f.label :source_branch, "From", class: "control-label" .controls - = f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") + = f.select(:source_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, style: "width:250px") .bottom_commit .mr_source_commit @@ -25,9 +25,9 @@ %h5 To (Base Branch) .body .padded - = f.label :target_branch, "To", :class => "control-label" + = f.label :target_branch, "To", class: "control-label" .controls - = f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") + = f.select(:target_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, style: "width:250px") .bottom_commit .mr_target_commit @@ -38,22 +38,22 @@ .top_box_content = f.label :title do %strong= "Title *" - .input= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5 + .input= f.text_field :title, class: "input-xxlarge pad", maxlength: 255, rows: 5 .middle_box_content = 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 user" }, :style => "width:250px") + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, style: "width:250px") .control-group .form-actions - = f.submit 'Save', :class => "btn-primary btn" + = f.submit 'Save', class: "btn-primary btn" - if @merge_request.new_record? - = link_to project_merge_requests_path(@project), :class => "btn" do + = link_to project_merge_requests_path(@project), class: "btn" do Cancel - else - = link_to project_merge_request_path(@project, @merge_request), :class => "btn" do + = link_to project_merge_request_path(@project, @merge_request), class: "btn" do Cancel diff --git a/app/views/merge_requests/_head.html.haml b/app/views/merge_requests/_head.html.haml index c578c794..35a86e65 100644 --- a/app/views/merge_requests/_head.html.haml +++ b/app/views/merge_requests/_head.html.haml @@ -1,5 +1,5 @@ .top-tabs - = link_to project_merge_requests_path(@project), :class => "tab #{'active' if current_page?(project_merge_requests_path(@project)) }" do + = link_to project_merge_requests_path(@project), class: "tab #{'active' if current_page?(project_merge_requests_path(@project)) }" do %span Merge Requests diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index 59af97a3..74996090 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -1,4 +1,4 @@ -%li.wll{ :class => mr_css_classes(merge_request) } +%li.wll{ class: mr_css_classes(merge_request) } .right .left - if merge_request.merged? @@ -14,9 +14,9 @@ = merge_request.source_branch → = merge_request.target_branch - = image_tag gravatar_icon(merge_request.author_email), :class => "avatar" + = image_tag gravatar_icon(merge_request.author_email), class: "avatar" - %p= link_to_gfm truncate(merge_request.title, :length => 80), project_merge_request_path(merge_request.project, merge_request), :class => "row_title" + %p= link_to_gfm truncate(merge_request.title, length: 80), project_merge_request_path(merge_request.project, merge_request), class: "row_title" %span.update-author %small.cdark= "##{merge_request.id}" diff --git a/app/views/merge_requests/_show.html.haml b/app/views/merge_requests/_show.html.haml index c0b3dd9f..072bf259 100644 --- a/app/views/merge_requests/_show.html.haml +++ b/app/views/merge_requests/_show.html.haml @@ -7,16 +7,16 @@ - if @commits.present? %ul.nav.nav-tabs.mr_nav_tabs %li - = link_to "#notes", "data-url" => project_merge_request_path(@project, @merge_request), :class => "merge-notes-tab tab" do + = link_to "#notes", "data-url" => project_merge_request_path(@project, @merge_request), class: "merge-notes-tab tab" do %i.icon-comment Comments %li - = link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), :class => "merge-diffs-tab tab" do + = link_to "#diffs", "data-url" => diffs_project_merge_request_path(@project, @merge_request), class: "merge-diffs-tab tab" do %i.icon-list-alt Diff -.merge_request_notes#notes{ :class => (controller.action_name == 'show') ? "" : "hide" } - = render("notes/notes", :tid => @merge_request.id, :tt => "merge_request") +.merge_request_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } + = render("notes/notes", tid: @merge_request.id, tt: "merge_request") .merge-request-diffs = render "merge_requests/show/diffs" if @diffs .status diff --git a/app/views/merge_requests/branch_from.js.haml b/app/views/merge_requests/branch_from.js.haml index 3e278015..156b4f0d 100644 --- a/app/views/merge_requests/branch_from.js.haml +++ b/app/views/merge_requests/branch_from.js.haml @@ -1,2 +1,2 @@ :plain - $(".mr_source_commit").html("#{escape_javascript(render 'commits/commit', :commit => @commit)}"); + $(".mr_source_commit").html("#{escape_javascript(render 'commits/commit', commit: @commit)}"); diff --git a/app/views/merge_requests/branch_to.js.haml b/app/views/merge_requests/branch_to.js.haml index 1ab1f6c4..8a201d42 100644 --- a/app/views/merge_requests/branch_to.js.haml +++ b/app/views/merge_requests/branch_to.js.haml @@ -1,3 +1,3 @@ :plain - $(".mr_target_commit").html("#{escape_javascript(render 'commits/commit', :commit => @commit)}"); + $(".mr_target_commit").html("#{escape_javascript(render 'commits/commit', commit: @commit)}"); diff --git a/app/views/merge_requests/commits.js.haml b/app/views/merge_requests/commits.js.haml index 2055aa9b..76322bdb 100644 --- a/app/views/merge_requests/commits.js.haml +++ b/app/views/merge_requests/commits.js.haml @@ -1,4 +1,4 @@ :plain - $(".merge-request-commits").html("#{escape_javascript(render(:partial => "commits"))}"); + $(".merge-request-commits").html("#{escape_javascript(render(partial: "commits"))}"); diff --git a/app/views/merge_requests/diffs.js.haml b/app/views/merge_requests/diffs.js.haml index 4be5ec13..b147e5be 100644 --- a/app/views/merge_requests/diffs.js.haml +++ b/app/views/merge_requests/diffs.js.haml @@ -1,4 +1,4 @@ :plain - $(".merge-request-diffs").html("#{escape_javascript(render(:partial => "merge_requests/show/diffs"))}"); + $(".merge-request-diffs").html("#{escape_javascript(render(partial: "merge_requests/show/diffs"))}"); diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index 5210b95e..4ad6e5c1 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -1,7 +1,7 @@ %h3.page_title Merge Requests - if can? current_user, :write_issue, @project - = link_to new_project_merge_request_path(@project), :class => "right btn small", :title => "New Merge Request" do + = link_to new_project_merge_request_path(@project), class: "right btn small", title: "New Merge Request" do New Merge Request %br @@ -10,17 +10,17 @@ .ui-box .title %ul.nav.nav-pills - %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} - = link_to project_merge_requests_path(@project, :f => 0) do + %li{class: ("active" if (params[:f] == "0" || !params[:f]))} + = link_to project_merge_requests_path(@project, f: 0) do Open - %li{:class => ("active" if params[:f] == "2")} - = link_to project_merge_requests_path(@project, :f => 2) do + %li{class: ("active" if params[:f] == "2")} + = link_to project_merge_requests_path(@project, f: 2) do Closed - %li{:class => ("active" if params[:f] == "3")} - = link_to project_merge_requests_path(@project, :f => 3) do + %li{class: ("active" if params[:f] == "3")} + = link_to project_merge_requests_path(@project, f: 3) do To Me - %li{:class => ("active" if params[:f] == "1")} - = link_to project_merge_requests_path(@project, :f => 1) do + %li{class: ("active" if params[:f] == "1")} + = link_to project_merge_requests_path(@project, f: 1) do All %ul.unstyled @@ -31,7 +31,7 @@ - if @merge_requests.present? %li.bottom .row - .span7= paginate @merge_requests, :theme => "gitlab" + .span7= paginate @merge_requests, theme: "gitlab" .span4.right %span.cgray.right #{@merge_requests.total_count} merge requests for this filter diff --git a/app/views/merge_requests/show.js.haml b/app/views/merge_requests/show.js.haml index 2922b3bc..7a27b166 100644 --- a/app/views/merge_requests/show.js.haml +++ b/app/views/merge_requests/show.js.haml @@ -1,2 +1,2 @@ :plain - $(".merge-request-notes").html("#{escape_javascript(render("notes/notes", :tid => @merge_request.id, :tt => "merge_request"))}"); + $(".merge-request-notes").html("#{escape_javascript(render("notes/notes", tid: @merge_request.id, tt: "merge_request"))}"); diff --git a/app/views/merge_requests/show/_commits.html.haml b/app/views/merge_requests/show/_commits.html.haml index d10e8fd5..d25e707c 100644 --- a/app/views/merge_requests/show/_commits.html.haml +++ b/app/views/merge_requests/show/_commits.html.haml @@ -7,19 +7,19 @@ - if @commits.count > 8 %ul.first_mr_commits.unstyled - @commits.first(8).each do |commit| - = render "commits/commit", :commit => commit + = render "commits/commit", commit: commit %li.bottom 8 of #{@commits.count} commits displayed. %strong %a.mr_show_all_commits Click here to show all %ul.all_mr_commits.hide.unstyled - @commits.each do |commit| - = render "commits/commit", :commit => commit + = render "commits/commit", commit: commit - else %ul.unstyled - @commits.each do |commit| - = render "commits/commit", :commit => commit + = render "commits/commit", commit: commit - else %h5 diff --git a/app/views/merge_requests/show/_diffs.html.haml b/app/views/merge_requests/show/_diffs.html.haml index 80776f19..76850903 100644 --- a/app/views/merge_requests/show/_diffs.html.haml +++ b/app/views/merge_requests/show/_diffs.html.haml @@ -1,8 +1,8 @@ - if @merge_request.valid_diffs? - = render "commits/diffs", :diffs => @diffs + = render "commits/diffs", diffs: @diffs - elsif @merge_request.broken_diffs? %h4.nothing_here_message Can't load diff. - You can #{link_to "download MR patch", raw_project_merge_request_path(@project, @merge_request), :class => "vlink"} instead. + You can #{link_to "download MR patch", raw_project_merge_request_path(@project, @merge_request), class: "vlink"} instead. - else %h4.nothing_here_message Nothing to merge diff --git a/app/views/merge_requests/show/_how_to_merge.html.haml b/app/views/merge_requests/show/_how_to_merge.html.haml index 2512d254..c21f2727 100644 --- a/app/views/merge_requests/show/_how_to_merge.html.haml +++ b/app/views/merge_requests/show/_how_to_merge.html.haml @@ -1,6 +1,6 @@ %div#modal_merge_info.modal.hide .modal-header - %a.close{:href => "#"} × + %a.close{href: "#"} × %h3 How To Merge .modal-body %pre diff --git a/app/views/merge_requests/show/_mr_accept.html.haml b/app/views/merge_requests/show/_mr_accept.html.haml index c158ef88..a6c2afb1 100644 --- a/app/views/merge_requests/show/_mr_accept.html.haml +++ b/app/views/merge_requests/show/_mr_accept.html.haml @@ -4,29 +4,29 @@ - if @merge_request.open? && @commits.any? && can?(current_user, :accept_mr, @project) - .automerge_widget.can_be_merged{:style => "display:none"} + .automerge_widget.can_be_merged{style: "display:none"} .alert.alert-success %span - = form_for [:automerge, @project, @merge_request], :remote => true, :method => :get do |f| + = form_for [:automerge, @project, @merge_request], remote: true, method: :get do |f| %p You can accept this request automatically. If you still want to do it manually - - %strong= link_to "click here", "#", :class => "how_to_merge_link vlink", :title => "How To Merge" + %strong= link_to "click here", "#", class: "how_to_merge_link vlink", title: "How To Merge" for instructions .accept_group - = f.submit "Accept Merge Request", :class => "btn small success accept_merge_request" + = f.submit "Accept Merge Request", class: "btn small success accept_merge_request" - unless @project.root_ref? @merge_request.source_branch .remove_branch_holder - = label_tag :should_remove_source_branch, :class => "checkbox" do + = label_tag :should_remove_source_branch, class: "checkbox" do = check_box_tag :should_remove_source_branch Remove source-branch .clearfix - .automerge_widget.cannot_be_merged{:style => "display:none"} + .automerge_widget.cannot_be_merged{style: "display:none"} .alert.alert-info %span - = link_to "Show how to merge", "#", :class => "how_to_merge_link btn small padded", :title => "How To Merge" + = link_to "Show how to merge", "#", class: "how_to_merge_link btn small padded", title: "How To Merge"   %strong This request cant be merged with GitLab. You should do it manually @@ -36,7 +36,7 @@ %i.icon-refresh Checking for ability to automatically merge… - .automerge_widget.already_cannot_be_merged{:style => "display:none"} + .automerge_widget.already_cannot_be_merged{style: "display:none"} .alert.alert-info %strong This merge request already can not be merged. Try to reload page. diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml index bb8bf1ce..81ab83f3 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -10,12 +10,12 @@ .middle_box_content %div %cite.cgray Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by - = image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av" + = image_tag gravatar_icon(@merge_request.author_email), width: 16, class: "lil_av" %strong.author= link_to_merge_request_author(@merge_request) - if @merge_request.assignee %cite.cgray and currently assigned to - = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" + = image_tag gravatar_icon(@merge_request.assignee_email), width: 16, class: "lil_av" %strong.author= link_to_merge_request_assignee(@merge_request) diff --git a/app/views/merge_requests/show/_mr_title.html.haml b/app/views/merge_requests/show/_mr_title.html.haml index 3f6060b0..31fa0779 100644 --- a/app/views/merge_requests/show/_mr_title.html.haml +++ b/app/views/merge_requests/show/_mr_title.html.haml @@ -13,13 +13,13 @@ = "MERGED" - if can?(current_user, :modify_merge_request, @merge_request) - if @merge_request.open? - = link_to raw_project_merge_request_path(@project, @merge_request), :class => "btn grouped" do + = link_to raw_project_merge_request_path(@project, @merge_request), class: "btn grouped" do %i.icon-download-alt Get Patch - = link_to 'Close', project_merge_request_path(@project, @merge_request, :merge_request => {:closed => true }, :status_only => true), :method => :put, :class => "btn grouped danger", :title => "Close merge request" + = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {closed: true }, status_only: true), method: :put, class: "btn grouped danger", title: "Close merge request" - = link_to edit_project_merge_request_path(@project, @merge_request), :class => "btn grouped" do + = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn grouped" do %i.icon-edit Edit diff --git a/app/views/milestones/_form.html.haml b/app/views/milestones/_form.html.haml index 69567eff..daae58fe 100644 --- a/app/views/milestones/_form.html.haml +++ b/app/views/milestones/_form.html.haml @@ -5,7 +5,7 @@ %hr -= form_for [@project, @milestone], :html => {:class => "new_milestone form-horizontal"} do |f| += form_for [@project, @milestone], html: {class: "new_milestone form-horizontal"} do |f| -if @milestone.errors.any? .alert-message.block-message.error %ul @@ -14,35 +14,35 @@ .row .span6 .control-group - = f.label :title, "Title", :class => "control-label" + = f.label :title, "Title", class: "control-label" .controls - = f.text_field :title, :maxlength => 255, :class => "input-xlarge" + = f.text_field :title, maxlength: 255, class: "input-xlarge" %p.help-block Required .control-group - = f.label :description, "Description", :class => "control-label" + = f.label :description, "Description", class: "control-label" .controls - = f.text_area :description, :maxlength => 2000, :class => "input-xlarge", :rows => 10 + = f.text_area :description, maxlength: 2000, class: "input-xlarge", rows: 10 %p.help-block Markdown is enabled. .span6 .control-group - = f.label :due_date, "Due Date", :class => "control-label" + = f.label :due_date, "Due Date", class: "control-label" .input= f.hidden_field :due_date .controls .datepicker .form-actions - if @milestone.new_record? - = f.submit 'Create milestone', :class => "primary btn" + = f.submit 'Create milestone', 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 @milestone.new_record? - = link_to "Cancel", project_milestones_path(@project), :class => "btn" + = link_to "Cancel", project_milestones_path(@project), class: "btn" - else - = link_to "Cancel", project_milestone_path(@project, @milestone), :class => "btn" + = link_to "Cancel", project_milestone_path(@project, @milestone), class: "btn" :javascript $(function() { diff --git a/app/views/milestones/_milestone.html.haml b/app/views/milestones/_milestone.html.haml index 06cf6304..205b864f 100644 --- a/app/views/milestones/_milestone.html.haml +++ b/app/views/milestones/_milestone.html.haml @@ -1,18 +1,18 @@ -%li{:class => "milestone", :id => dom_id(milestone) } +%li{class: "milestone", id: dom_id(milestone) } .right - if milestone.issues.any? %span.btn.small.disabled.grouped= pluralize milestone.issues.count, 'issues' - if milestone.issues.count > 0 - = link_to 'Browse Issues', project_issues_path(milestone.project, :milestone_id => milestone.id), :class => "btn small grouped" + = link_to 'Browse Issues', project_issues_path(milestone.project, milestone_id: milestone.id), class: "btn small grouped" - if can? current_user, :admin_milestone, milestone.project - = link_to 'Edit', edit_project_milestone_path(milestone.project, milestone), :class => "btn small edit-milestone-link grouped" + = link_to 'Edit', edit_project_milestone_path(milestone.project, milestone), class: "btn small edit-milestone-link grouped" %h4 - = link_to_gfm truncate(milestone.title, :length => 100), project_milestone_path(milestone.project, milestone), :class => "row_title" + = link_to_gfm truncate(milestone.title, length: 100), project_milestone_path(milestone.project, milestone), class: "row_title" %small = milestone.expires_at %br .progress.progress-success.span3 - .bar{:style => "width: #{milestone.percent_complete}%;"} + .bar{style: "width: #{milestone.percent_complete}%;"}   diff --git a/app/views/milestones/index.html.haml b/app/views/milestones/index.html.haml index ed85166f..ecb008dc 100644 --- a/app/views/milestones/index.html.haml +++ b/app/views/milestones/index.html.haml @@ -3,23 +3,23 @@ %h3.page_title Milestones - if can? current_user, :admin_milestone, @project - = link_to "New Milestone", new_project_milestone_path(@project), :class => "right btn small", :title => "New Milestone" + = link_to "New Milestone", new_project_milestone_path(@project), class: "right btn small", title: "New Milestone" %br %div.ui-box .title %ul.nav.nav-pills - %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} - = link_to project_milestones_path(@project, :f => 0) do + %li{class: ("active" if (params[:f] == "0" || !params[:f]))} + = link_to project_milestones_path(@project, f: 0) do Active - %li{:class => ("active" if params[:f] == "1")} - = link_to project_milestones_path(@project, :f => 1) do + %li{class: ("active" if params[:f] == "1")} + = link_to project_milestones_path(@project, f: 1) do All %ul.unstyled = render @milestones - if @milestones.present? - %li.bottom= paginate @milestones, :remote => true, :theme => "gitlab" + %li.bottom= paginate @milestones, remote: true, theme: "gitlab" - else %li %h3.nothing_here_message Nothing to show here diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index 1a731810..b7da7b66 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -4,9 +4,9 @@ = @milestone.expires_at %span.right - = link_to 'Browse Issues', project_issues_path(@milestone.project, :milestone_id => @milestone.id), :class => "btn edit-milestone-link small grouped" + = link_to 'Browse Issues', project_issues_path(@milestone.project, milestone_id: @milestone.id), class: "btn edit-milestone-link small grouped" - if can?(current_user, :admin_milestone, @project) - = link_to edit_project_milestone_path(@project, @milestone), :class => "btn small grouped" do + = link_to edit_project_milestone_path(@project, @milestone), class: "btn small grouped" do %i.icon-edit Edit @@ -32,7 +32,7 @@ – #{@milestone.issues.closed.count} closed .progress.progress-success - .bar{:style => "width: #{@milestone.percent_complete}%;"} + .bar{style: "width: #{@milestone.percent_complete}%;"} - if @milestone.description.present? @@ -51,9 +51,9 @@ = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – - = link_to_gfm truncate(issue.title, :length => 60), [@project, issue] + = link_to_gfm truncate(issue.title, length: 60), [@project, issue] %br - = paginate @issues, :theme => "gitlab" + = paginate @issues, theme: "gitlab" .span6 %table.admin-table @@ -62,6 +62,6 @@ - @users.each do |user| %tr %td - = image_tag gravatar_icon(user.email, 24), :width => "24" + = image_tag gravatar_icon(user.email, 24), width: "24"   = user.name diff --git a/app/views/notes/_create_common.js.haml b/app/views/notes/_create_common.js.haml index 583812bf..847ff383 100644 --- a/app/views/notes/_create_common.js.haml +++ b/app/views/notes/_create_common.js.haml @@ -2,7 +2,7 @@ :plain $("#new_note .errors").remove(); $('#new_note textarea').val(""); - NoteList.prepend(#{note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => note})}"); + NoteList.prepend(#{note.id}, "#{escape_javascript(render partial: "notes/show", locals: {note: note})}"); - else :plain $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/notes/_create_line.js.haml b/app/views/notes/_create_line.js.haml index 9cf085cd..13809bec 100644 --- a/app/views/notes/_create_line.js.haml +++ b/app/views/notes/_create_line.js.haml @@ -4,5 +4,5 @@ $('#new_note textarea').val(""); $("a.line_note_reply_link[line_code='#{note.line_code}']").closest("tr").remove(); var trEl = $(".#{note.line_code}").parent(); - trEl.after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => note})}"); - trEl.after("#{escape_javascript(render :partial => "notes/reply_button", :locals => {:line_code => note.line_code})}"); + trEl.after("#{escape_javascript(render partial: "notes/per_line_show", locals: {note: note})}"); + trEl.after("#{escape_javascript(render partial: "notes/reply_button", locals: {line_code: note.line_code})}"); diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml index f5571aed..dac026bd 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/notes/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @note], :remote => "true", :multipart => true do |f| += form_for [@project, @note], remote: "true", multipart: true do |f| %h3.page_title Leave a comment -if @note.errors.any? .alert-message.block-message.error @@ -7,16 +7,16 @@ = f.hidden_field :noteable_id = f.hidden_field :noteable_type - = f.text_area :note, :size => 255 + = f.text_area :note, size: 255 #preview-note.well.hide %p.hint - = link_to "Gitlab Markdown", help_markdown_path, :target => '_blank' + = link_to "Gitlab Markdown", help_markdown_path, target: '_blank' is enabled. - = link_to 'Preview', preview_project_notes_path(@project), :id => 'preview-link' + = link_to 'Preview', preview_project_notes_path(@project), id: 'preview-link' .row.note_advanced_opts.hide .span2 - = f.submit 'Add Comment', :class => "btn primary submit_note", :id => "submit_note" + = f.submit 'Add Comment', class: "btn primary submit_note", id: "submit_note" .span4.notify_opts %h6.left Notify via email: = label_tag :notify do @@ -33,6 +33,6 @@ .input.input_file %a.file_upload.btn.small Upload File - = f.file_field :attachment, :class => "input-file" + = f.file_field :attachment, class: "input-file" %span.hint Any file less than 10 MB diff --git a/app/views/notes/_load.js.haml b/app/views/notes/_load.js.haml index 1f355967..c16a699a 100644 --- a/app/views/notes/_load.js.haml +++ b/app/views/notes/_load.js.haml @@ -1,15 +1,15 @@ - unless @notes.blank? - if params[:last_id] :plain - NoteList.replace("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); + NoteList.replace("#{escape_javascript(render(partial: 'notes/notes_list'))}"); - elsif params[:first_id] :plain - NoteList.append(#{@notes.last.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}"); + NoteList.append(#{@notes.last.id}, "#{escape_javascript(render(partial: 'notes/notes_list'))}"); - else :plain - NoteList.setContent(#{@notes.last.id}, #{@notes.first.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}"); + NoteList.setContent(#{@notes.last.id}, #{@notes.first.id}, "#{escape_javascript(render(partial: 'notes/notes_list'))}"); - else - if params[:first_id] diff --git a/app/views/notes/_notes_list.html.haml b/app/views/notes/_notes_list.html.haml index 1e4a6bb2..5673988d 100644 --- a/app/views/notes/_notes_list.html.haml +++ b/app/views/notes/_notes_list.html.haml @@ -1,4 +1,4 @@ - @notes.each do |note| - next unless note.author - = render :partial => "notes/show", :locals => {:note => note} + = render partial: "notes/show", locals: {note: note} diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_per_line_form.html.haml index a5a70053..afb0b30d 100644 --- a/app/views/notes/_per_line_form.html.haml +++ b/app/views/notes/_per_line_form.html.haml @@ -1,7 +1,7 @@ -%table{:style => "display:none;"} +%table{style: "display:none;"} %tr.per_line_form - %td{:colspan => 3 } - = form_for [@project, @note], :remote => "true", :multipart => true do |f| + %td{colspan: 3 } + = form_for [@project, @note], remote: "true", multipart: true do |f| %h3.page_title Leave a note %div.span10 -if @note.errors.any? @@ -12,11 +12,11 @@ = f.hidden_field :noteable_id = f.hidden_field :noteable_type = f.hidden_field :line_code - = f.text_area :note, :size => 255 + = f.text_area :note, size: 255 .note_actions .buttons - = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note" - = link_to "Cancel", "#", :class => "btn hide-button" + = f.submit 'Add note', class: "btn primary submit_note", id: "submit_note" + = link_to "Cancel", "#", class: "btn hide-button" .options %h6.left Notify via email: .labels diff --git a/app/views/notes/_per_line_show.html.haml b/app/views/notes/_per_line_show.html.haml index e239c618..cf1769c0 100644 --- a/app/views/notes/_per_line_show.html.haml +++ b/app/views/notes/_per_line_show.html.haml @@ -1,5 +1,5 @@ %tr.line_notes_row - %td{:colspan => 3} + %td{colspan: 3} %ul - = render :partial => "notes/show", :locals => {:note => note} + = render partial: "notes/show", locals: {note: note} diff --git a/app/views/notes/_reply_button.html.haml b/app/views/notes/_reply_button.html.haml index db6b35b7..c981fb9f 100644 --- a/app/views/notes/_reply_button.html.haml +++ b/app/views/notes/_reply_button.html.haml @@ -1,4 +1,4 @@ %tr.line_notes_row.reply - %td{:colspan => 3} + %td{colspan: 3} %i.icon-comment - = link_to "Reply", "#", :class => "line_note_reply_link", "line_code" => line_code, :title => "Add note for this line" + = link_to "Reply", "#", class: "line_note_reply_link", "line_code" => line_code, title: "Add note for this line" diff --git a/app/views/notes/_show.html.haml b/app/views/notes/_show.html.haml index 62aca154..bdb00546 100644 --- a/app/views/notes/_show.html.haml +++ b/app/views/notes/_show.html.haml @@ -1,5 +1,5 @@ -%li{:id => dom_id(note), :class => "note"} - = image_tag gravatar_icon(note.author.email), :class => "avatar" +%li{id: dom_id(note), class: "note"} + = image_tag gravatar_icon(note.author.email), class: "avatar" %div.note-author %strong= note.author_name = link_to "##{dom_id(note)}", name: dom_id(note) do @@ -7,7 +7,7 @@ = time_ago_in_words(note.updated_at) ago - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) - = link_to [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-note btn very_small" do + = link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do %i.icon-trash Remove @@ -17,5 +17,5 @@ - if note.attachment.url .right %div.file - = link_to note.attachment_identifier, note.attachment.url, :target => "_blank" + = link_to note.attachment_identifier, note.attachment.url, target: "_blank" .clear diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml index e87dbcf6..8f631f38 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/notes/create.js.haml @@ -1,7 +1,7 @@ - if @note.line_code - = render "create_line", :note => @note + = render "create_line", note: @note - else - = render "create_common", :note => @note + = render "create_common", note: @note -# Enable submit button :plain diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml index 08eea553..654d6cd1 100644 --- a/app/views/notify/new_issue_email.html.haml +++ b/app/views/notify/new_issue_email.html.haml @@ -1,15 +1,15 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} New Issue was created and assigned to you. - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, :length => 45), project_issue_url(@issue.project, @issue), :title => @issue.title + = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title %br diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index 4bacff50..151aac45 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -1,18 +1,18 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "New Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Branches: #{@merge_request.source_branch} → #{@merge_request.target_branch} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Asignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} %td diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml index b0f198a5..d96afc92 100644 --- a/app/views/notify/new_user_email.html.haml +++ b/app/views/notify/new_user_email.html.haml @@ -1,23 +1,23 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} Hi #{@user['name']}! - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Administrator created account for you. Now you are a member of company gitlab application. - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} login.......................................... %code= @user['email'] - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} password.................................. %code= @password - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} = link_to "Click here to login", root_url - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml index 6994f1a6..e87f9c12 100644 --- a/app/views/notify/note_commit_email.html.haml +++ b/app/views/notify/note_commit_email.html.haml @@ -1,23 +1,23 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "New comment for Commit #{@commit.short_id}" - = link_to_gfm truncate(@commit.title, :length => 16), project_commit_url(@note.project, :id => @commit.id, :anchor => "note_#{@note.id}") - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@commit.title, length: 16), project_commit_url(@note.project, id: @commit.id, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} left next message: %br - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr - %td{:valign => "top"} - %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %td{valign: "top"} + %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } = markdown(@note.note) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_issue_email.html.haml b/app/views/notify/note_issue_email.html.haml index 34d9b800..832f5df4 100644 --- a/app/views/notify/note_issue_email.html.haml +++ b/app/views/notify/note_issue_email.html.haml @@ -1,23 +1,23 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "New comment for Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, :length => 35), project_issue_url(@issue.project, @issue, :anchor => "note_#{@note.id}") - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@issue.title, length: 35), project_issue_url(@issue.project, @issue, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} left next message: %br - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr - %td{:valign => "top"} - %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %td{valign: "top"} + %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } = markdown(@note.note) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml index 20e7679d..764cd094 100644 --- a/app/views/notify/note_merge_request_email.html.haml +++ b/app/views/notify/note_merge_request_email.html.haml @@ -1,23 +1,23 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "New comment for Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request, :anchor => "note_#{@note.id}") - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} left next message: %br - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr - %td{:valign => "top"} - %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %td{valign: "top"} + %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } = markdown(@note.note) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_wall_email.html.haml b/app/views/notify/note_wall_email.html.haml index f62e1f91..0661c580 100644 --- a/app/views/notify/note_wall_email.html.haml +++ b/app/views/notify/note_wall_email.html.haml @@ -1,22 +1,22 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} New message on - = link_to "Project Wall", wall_project_url(@note.project, :anchor => "note_#{@note.id}") - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to "Project Wall", wall_project_url(@note.project, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} left next message: %br - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr - %td{:valign => "top"} - %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %td{valign: "top"} + %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } = markdown(@note.note) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_wiki_email.html.haml b/app/views/notify/note_wiki_email.html.haml index 59131951..d3840cda 100644 --- a/app/views/notify/note_wiki_email.html.haml +++ b/app/views/notify/note_wiki_email.html.haml @@ -1,23 +1,23 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} New comment for Wiki page - = link_to_gfm @wiki.title, project_issue_url(@wiki.project, @wiki, :anchor => "note_#{@note.id}") - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm @wiki.title, project_issue_url(@wiki.project, @wiki, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{:href => "#", :style => "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} commented on Wiki page: %br - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :width => "558"} + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr - %td{:valign => "top"} - %div{ :style => "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %td{valign: "top"} + %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } = markdown(@note.note) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml index 26ddc133..c7896af3 100644 --- a/app/views/notify/reassigned_issue_email.html.haml +++ b/app/views/notify/reassigned_issue_email.html.haml @@ -1,16 +1,16 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Reassigned Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, :length => 16), project_issue_url(@issue.project, @issue) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@issue.title, length: 16), project_issue_url(@issue.project, @issue) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Assignee changed from #{@previous_assignee.name} to #{@issue.assignee_name} %td diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml index e9f657c1..e49b7836 100644 --- a/app/views/notify/reassigned_merge_request_email.html.haml +++ b/app/views/notify/reassigned_merge_request_email.html.haml @@ -1,16 +1,16 @@ -%td.content{:align => "left", :style => "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", :valign => "top", :width => "600"} - %table{:border => "0", :cellpadding => "0", :cellspacing => "0", :style => "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", :width => "600"} +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:align => "left", :style => "padding: 20px 0 0;"} - %h2{:style => "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{align: "left", style: "padding: 20px 0 0;"} + %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Reassigned Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, :length => 16), project_merge_request_url(@merge_request.project, @merge_request) - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} + = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{:style => "font-size: 1px; line-height: 1px;", :width => "21"} - %td{:style => "padding: 15px 0 15px;", :valign => "top"} - %p{:style => "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{style: "padding: 15px 0 15px;", valign: "top"} + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Assignee changed from #{@previous_assignee.name} to #{@merge_request.assignee_name} %td diff --git a/app/views/profile/design.html.haml b/app/views/profile/design.html.haml index ff6ae7f5..a3455ced 100644 --- a/app/views/profile/design.html.haml +++ b/app/views/profile/design.html.haml @@ -1,4 +1,4 @@ -= form_for @user, :url => profile_update_path, :remote => true, :method => :put do |f| += form_for @user, url: profile_update_path, remote: true, method: :put do |f| %div %h3 Application theme %hr @@ -18,16 +18,16 @@ %h3 Code review %hr .row - %label.span3{:for => "user_dark_scheme_false"} + %label.span3{for: "user_dark_scheme_false"} .thumbnail - = image_tag "white.png", :width => 260, :class => "styled_image" + = image_tag "white.png", width: 260, class: "styled_image" .caption %h5 = f.radio_button :dark_scheme, false White code preview - %label.span3{:for => "user_dark_scheme_true"} + %label.span3{for: "user_dark_scheme_true"} .thumbnail - = image_tag "dark.png", :width => 260, :class => "styled_image" + = image_tag "dark.png", width: 260, class: "styled_image" .caption %h5 = f.radio_button :dark_scheme, true diff --git a/app/views/profile/password.html.haml b/app/views/profile/password.html.haml index 1662f4d9..257dacb1 100644 --- a/app/views/profile/password.html.haml +++ b/app/views/profile/password.html.haml @@ -1,6 +1,6 @@ %h3.page_title Password %hr -= form_for @user, :url => profile_password_path, :method => :put do |f| += form_for @user, url: profile_password_path, method: :put do |f| .data %p.slead After successful password update you will be redirected to login page where you should login with new password -if @user.errors.any? @@ -16,4 +16,4 @@ = f.label :password_confirmation .input= f.password_field :password_confirmation .actions - = f.submit 'Save', :class => "btn primary" + = f.submit 'Save', class: "btn primary" diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml index b2689013..95cce2bb 100644 --- a/app/views/profile/show.html.haml +++ b/app/views/profile/show.html.haml @@ -1,5 +1,5 @@ .profile_avatar_holder - = image_tag gravatar_icon(@user.email, 90), :class => "styled_image" + = image_tag gravatar_icon(@user.email, 90), class: "styled_image" %h3.page_title = @user.name %br @@ -9,7 +9,7 @@ %hr -= form_for @user, :url => profile_update_path, :method => :put, :html => { :class => "edit_user form-horizontal" } do |f| += form_for @user, url: profile_update_path, method: :put, html: { class: "edit_user form-horizontal" } do |f| -if @user.errors.any? %div.alert-message.block-message.error %ul @@ -18,30 +18,30 @@ .row .span7 .control-group - = f.label :name, :class => "control-label" + = f.label :name, class: "control-label" .controls - = f.text_field :name, :class => "input-xlarge" + = f.text_field :name, class: "input-xlarge" %span.help-block Enter your name, so people you know can recognize you. .control-group - = f.label :email, :class => "control-label" + = f.label :email, class: "control-label" .controls - = f.text_field :email, :class => "input-xlarge" + = f.text_field :email, class: "input-xlarge" %span.help-block We also use email for avatar detection. %hr .control-group - = f.label :skype, :class => "control-label" - .controls= f.text_field :skype, :class => "input-xlarge" + = f.label :skype, class: "control-label" + .controls= f.text_field :skype, class: "input-xlarge" .control-group - = f.label :linkedin, :class => "control-label" - .controls= f.text_field :linkedin, :class => "input-xlarge" + = f.label :linkedin, class: "control-label" + .controls= f.text_field :linkedin, class: "input-xlarge" .control-group - = f.label :twitter, :class => "control-label" - .controls= f.text_field :twitter, :class => "input-xlarge" + = f.label :twitter, class: "control-label" + .controls= f.text_field :twitter, class: "input-xlarge" .control-group - = f.label :bio, :class => "control-label" + = f.label :bio, class: "control-label" .controls - = f.text_area :bio, :rows => 6, :class => "input-xlarge", :maxlength => 250 + = f.text_area :bio, rows: 6, class: "input-xlarge", maxlength: 250 %span.help-block Tell us about yourself in fewer than 250 characters. .span5.right @@ -56,14 +56,14 @@ of %span= current_user.projects_limit .progress - .bar{:style => "width: #{current_user.projects_limit_percent}%;"} + .bar{style: "width: #{current_user.projects_limit_percent}%;"} %h4 SSH public keys: %small.right %span= link_to current_user.keys.count, keys_path - = link_to "Add Public Key", new_key_path, :class => "btn small right" + = link_to "Add Public Key", new_key_path, class: "btn small right" .form-actions - = f.submit 'Save', :class => "btn-primary btn" + = f.submit 'Save', class: "btn-primary btn" diff --git a/app/views/profile/token.html.haml b/app/views/profile/token.html.haml index 3a0ec90b..6c870c36 100644 --- a/app/views/profile/token.html.haml +++ b/app/views/profile/token.html.haml @@ -3,7 +3,7 @@ %span.cred.right keep it in secret! %hr -= form_for @user, :url => profile_reset_private_token_path, :method => :put do |f| += form_for @user, url: profile_reset_private_token_path, method: :put do |f| .data %p.slead Private token used to access application resources without authentication. @@ -11,13 +11,13 @@ It can be used for atom feed or API %p.cgray - if current_user.private_token - = text_field_tag "token", current_user.private_token, :class => "xxlarge large_text" + = text_field_tag "token", current_user.private_token, class: "xxlarge large_text" - else You don`t have one yet. Click generate to fix it. .actions - if current_user.private_token - = f.submit 'Reset', :confirm => "Are you sure?", :class => "btn" + = f.submit 'Reset', confirm: "Are you sure?", class: "btn" - else - = f.submit 'Generate', :class => "btn primary" + = f.submit 'Generate', class: "btn primary" diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 6bc48df9..ce66b2cf 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -1,4 +1,4 @@ -= form_for(@project, :remote => true) do |f| += form_for(@project, remote: true) do |f| - if @project.errors.any? .alert-message.block-message.error %ul @@ -8,7 +8,7 @@ = f.label :name do Project name is .input - = f.text_field :name, :placeholder => "Example Project", :class => "xxlarge" + = f.text_field :name, placeholder: "Example Project", class: "xxlarge" %h5.page_title .alert.alert-info @@ -19,19 +19,19 @@ .input .input-prepend %strong - = text_field_tag :ppath, @project.path_to_repo, :class => "xlarge", :disabled => true + = text_field_tag :ppath, @project.path_to_repo, class: "xlarge", disabled: true .clearfix = f.label :code do URL .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? || @project.heads.empty? .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 @@ -56,8 +56,8 @@ %br .actions - = f.submit 'Save', :class => "btn primary" - = link_to 'Cancel', @project, :class => "btn" + = f.submit 'Save', class: "btn primary" + = link_to 'Cancel', @project, class: "btn" - unless @project.new_record? .right - = link_to 'Remove', @project, :confirm => 'Are you sure?', :method => :delete, :class => "btn danger" + = link_to 'Remove', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger" diff --git a/app/views/projects/_new_form.html.haml b/app/views/projects/_new_form.html.haml index 9f3bfa86..5104df83 100644 --- a/app/views/projects/_new_form.html.haml +++ b/app/views/projects/_new_form.html.haml @@ -1,4 +1,4 @@ -= form_for(@project, :remote => true) do |f| += form_for(@project, remote: true) do |f| - if @project.errors.any? .alert-message.block-message.error %span= @project.errors.full_messages.first @@ -6,8 +6,8 @@ = f.label :name do Project name is .input - = f.text_field :name, :placeholder => "Example Project", :class => "xxlarge" - = f.submit 'Create project', :class => "btn primary" + = f.text_field :name, placeholder: "Example Project", class: "xxlarge" + = f.submit 'Create project', class: "btn primary" %hr .alert.alert-info @@ -18,7 +18,7 @@ .input .input-prepend %span.add-on= Gitlab.config.ssh_path - = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? + = f.text_field :path, placeholder: "example_project", disabled: !@project.new_record? %span.add-on= ".git" .clearfix = f.label :code do @@ -26,4 +26,4 @@ .input .input-prepend %span.add-on= web_app_url - = f.text_field :code, :placeholder => "example" + = f.text_field :code, placeholder: "example" diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml index f3ac3c27..ba64ee7f 100644 --- a/app/views/projects/_project_head.html.haml +++ b/app/views/projects/_project_head.html.haml @@ -1,29 +1,29 @@ %ul.nav.nav-tabs - %li{ :class => "#{'active' if current_page?(project_path(@project)) }" } - = link_to project_path(@project), :class => "activities-tab tab" do + %li{ class: "#{'active' if current_page?(project_path(@project)) }" } + = link_to project_path(@project), class: "activities-tab tab" do %i.icon-home Show - %li{ :class => " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" } - = link_to team_project_path(@project), :class => "team-tab tab" do + %li{ class: " #{'active' if (controller.controller_name == "team_members") || current_page?(team_project_path(@project)) }" } + = link_to team_project_path(@project), class: "team-tab tab" do %i.icon-user Team - %li{ :class => "#{'active' if current_page?(files_project_path(@project)) }" } - = link_to files_project_path(@project), :class => "files-tab tab " do + %li{ class: "#{'active' if current_page?(files_project_path(@project)) }" } + = link_to files_project_path(@project), class: "files-tab tab " do Attachments - %li{ :class => " #{'active' if (controller.controller_name == "snippets") }" } - = link_to project_snippets_path(@project), :class => "snippets-tab tab" do + %li{ class: " #{'active' if (controller.controller_name == "snippets") }" } + = link_to project_snippets_path(@project), class: "snippets-tab tab" do Snippets - if can? current_user, :admin_project, @project - %li.right{:class => "#{'active' if controller.controller_name == "deploy_keys"}"} + %li.right{class: "#{'active' if controller.controller_name == "deploy_keys"}"} = link_to project_deploy_keys_path(@project) do %span Deploy Keys - %li.right{:class => "#{'active' if controller.controller_name == "hooks" }"} + %li.right{class: "#{'active' if controller.controller_name == "hooks" }"} = link_to project_hooks_path(@project) do %span Hooks - %li.right{ :class => "#{'active' if current_page?(edit_project_path(@project)) }" } - = link_to edit_project_path(@project), :class => "stat-tab tab " do + %li.right{ class: "#{'active' if current_page?(edit_project_path(@project)) }" } + = link_to edit_project_path(@project), class: "stat-tab tab " do %i.icon-edit Edit diff --git a/app/views/projects/_refs.html.haml b/app/views/projects/_refs.html.haml index af15fbdf..804b8523 100644 --- a/app/views/projects/_refs.html.haml +++ b/app/views/projects/_refs.html.haml @@ -1,5 +1,5 @@ -= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form" do - = select_tag "ref", grouped_options_refs, :onchange => "this.form.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.submit();", class: "project-refs-select" = hidden_field_tag :destination, destination :javascript diff --git a/app/views/projects/_show.html.haml b/app/views/projects/_show.html.haml index c6755fa7..e8a5b00d 100644 --- a/app/views/projects/_show.html.haml +++ b/app/views/projects/_show.html.haml @@ -2,9 +2,9 @@ = @project.name %br %div - %a.btn.info{:href => tree_project_ref_path(@project, @project.root_ref)} Browse code + %a.btn.info{href: tree_project_ref_path(@project, @project.root_ref)} Browse code   - %a.btn{:href => project_commits_path(@project)} Commits + %a.btn{href: project_commits_path(@project)} Commits %strong.right = link_to project_path(@project) do Switch to project → @@ -13,7 +13,7 @@ .input .input-prepend %span.add-on git clone - = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" + = text_field_tag :project_clone, @project.url_to_repo, class: "xlarge one_click_select git_clone_url" = simple_format @project.description - unless @events.blank? diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml index 58393460..175aea27 100644 --- a/app/views/projects/_team.html.haml +++ b/app/views/projects/_team.html.haml @@ -5,7 +5,7 @@ %th Permissions %tbody - @project.users_projects.each do |up| - = render(:partial => 'team_members/show', :locals => {:member => up}) + = render(partial: 'team_members/show', locals: {member: up}) :javascript diff --git a/app/views/projects/create.js.haml b/app/views/projects/create.js.haml index eeefc172..2f6264a1 100644 --- a/app/views/projects/create.js.haml +++ b/app/views/projects/create.js.haml @@ -1,6 +1,6 @@ - if @project.saved? :plain - location.href = "#{project_path(@project, :notice => 'Project was successfully created.')}"; + location.href = "#{project_path(@project, notice: 'Project was successfully created.')}"; - else - if @project.git_error? location.href = "#{errors_githost_path}"; diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index eef113e0..b8d0dad9 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -16,7 +16,7 @@ - setup_str = ["git config --global user.name \"#{current_user.name}\"", "git config --global user.email \"#{current_user.email}\""].join("\n") = preserve do - = raw bash_lexer.highlight(setup_str, :lexer => 'bash', :options => {:encoding => 'utf-8'}) + = raw bash_lexer.highlight(setup_str, lexer: 'bash', options: {encoding: 'utf-8'}) %br %br @@ -44,4 +44,4 @@ - if can? current_user, :admin_project, @project .alert-message.block-message.error.prepend-top-20 - = link_to 'Remove project', @project, :confirm => 'Are you sure?', :method => :delete, :class => "btn danger" + = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger" diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml index 52424ae4..68d51df0 100644 --- a/app/views/projects/files.html.haml +++ b/app/views/projects/files.html.haml @@ -4,8 +4,8 @@ - @notes.each do |note| %tr %td - %a{:href => note.attachment.url} - = image_tag gravatar_icon(note.author_email), :class => "left", :width => 16 + %a{href: note.attachment.url} + = image_tag gravatar_icon(note.author_email), class: "left", width: 16   = note.attachment_identifier %td diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 7c5b11e4..ebd2c8e4 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -7,23 +7,23 @@ .input-prepend.project_clone_holder %span.add-on git clone - = link_to "SSH", "#", :class => "btn small active", :"data-clone" => @project.ssh_url_to_repo - = link_to "HTTP", "#", :class => "btn small", :"data-clone" => @project.http_url_to_repo - = text_field_tag :project_clone, @project.url_to_repo, :class => "one_click_select span5" + = link_to "SSH", "#", class: "btn small active", :"data-clone" => @project.ssh_url_to_repo + = link_to "HTTP", "#", class: "btn small", :"data-clone" => @project.http_url_to_repo + = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" .span4.right .right - if can? current_user, :download_code, @project - = link_to archive_project_repository_path(@project), :class => "btn small grouped" do + = link_to archive_project_repository_path(@project), class: "btn small grouped" do %i.icon-download-alt Download - if @project.merge_requests_enabled && can?(current_user, :write_merge_request, @project) - = link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "btn small grouped" do + = link_to new_project_merge_request_path(@project), title: "New Merge Request", class: "btn small grouped" do Merge Request - if @project.issues_enabled && can?(current_user, :write_issue, @project) - = link_to new_project_issue_path(@project), :title => "New Issue", :class => "btn small grouped" do + = link_to new_project_issue_path(@project), title: "New Issue", class: "btn small grouped" do Issue -= render "events/event_last_push", :event => @last_push += render "events/event_last_push", event: @last_push .content_list= render @events :javascript diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml index 90be0414..e8a825c7 100644 --- a/app/views/projects/team.html.haml +++ b/app/views/projects/team.html.haml @@ -5,11 +5,11 @@ - if can? current_user, :admin_team_member, @project %p.slead - = link_to new_project_team_member_path(@project), :class => "btn small right", :title => "New Team Member" do + = link_to new_project_team_member_path(@project), class: "btn small right", title: "New Team Member" do New Team Member Read more about project permissions - %strong= link_to "here", help_permissions_path, :class => "vlink" + %strong= link_to "here", help_permissions_path, class: "vlink" -= render :partial => "team", :locals => {:project => @project} += render partial: "team", locals: {project: @project} diff --git a/app/views/projects/tree.js.haml b/app/views/projects/tree.js.haml index eb08adb1..ba5d53c1 100644 --- a/app/views/projects/tree.js.haml +++ b/app/views/projects/tree.js.haml @@ -1,5 +1,5 @@ :plain $("#tree-holder table").hide("slide", { direction: "left" }, 150, function(){ - $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); + $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {repo: @repo, commit: @commit, tree: @tree}))}"); $("#tree-holder table").show("slide", { direction: "right" }, 150); }); diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml index ee0d3699..a961dc39 100644 --- a/app/views/projects/update.js.haml +++ b/app/views/projects/update.js.haml @@ -1,6 +1,6 @@ - if @project.valid? :plain - location.href = "#{edit_project_path(@project, :notice => 'Project was successfully updated.')}"; + location.href = "#{edit_project_path(@project, notice: 'Project was successfully updated.')}"; - else :plain $('.project_edit_holder').show(); diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml index bd538e8f..97765d7a 100644 --- a/app/views/projects/wall.html.haml +++ b/app/views/projects/wall.html.haml @@ -1,2 +1,2 @@ %div.wall_page - = render "notes/notes", :tid => nil, :tt => "wall" + = render "notes/notes", tid: nil, tt: "wall" diff --git a/app/views/protected_branches/index.html.haml b/app/views/protected_branches/index.html.haml index 586d4f63..2b93b0a8 100644 --- a/app/views/protected_branches/index.html.haml +++ b/app/views/protected_branches/index.html.haml @@ -1,12 +1,12 @@ = render "repositories/branches_head" .alert - %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, :class => "vlink"}. + %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. %p This ability allows: %ul %li keep stable branches secured %li forced code review before merge to protected branches - %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"} - if can? current_user, :admin_project, @project = form_for [@project, @protected_branch] do |f| @@ -19,9 +19,9 @@ .entry.clearfix = f.label :name, "Branch" .span3 - = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , { :include_blank => "-- Select branch" }, { :class => "span3" }) + = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , { include_blank: "-- Select branch" }, { class: "span3" })   - = f.submit 'Protect', :class => "primary btn" + = f.submit 'Protect', class: "primary btn" - unless @branches.empty? %table.admin-table @@ -34,18 +34,18 @@ - @branches.each do |branch| %tr %td - = link_to project_commits_path(@project, :ref => branch.name) do + = link_to project_commits_path(@project, ref: branch.name) do %strong= branch.name - if branch.name == @project.root_ref %span.label default %td = link_to project_commit_path(@project, branch.commit.id) do - = truncate branch.commit.id.to_s, :length => 10 + = truncate branch.commit.id.to_s, length: 10 = time_ago_in_words(branch.commit.committed_date) ago %td - if can? current_user, :admin_project, @project - = link_to 'Unprotect', [@project, branch], :confirm => 'Are you sure?', :method => :delete, :class => "danger btn small" + = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "danger btn small" :javascript $('select#protected_branch_name').chosen(); diff --git a/app/views/refs/_head.html.haml b/app/views/refs/_head.html.haml index 16a0cddf..8825493a 100644 --- a/app/views/refs/_head.html.haml +++ b/app/views/refs/_head.html.haml @@ -1,10 +1,10 @@ %ul.nav.nav-tabs %li - = form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form", :remote => true 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", remote: true do + = select_tag "ref", grouped_options_refs, onchange: "$(this.form).trigger('submit');", class: "project-refs-select" = hidden_field_tag :destination, "tree" = hidden_field_tag :path, params[:path] - %li{:class => "#{'active' if (controller.controller_name == "refs") }"} + %li{class: "#{'active' if (controller.controller_name == "refs") }"} = link_to tree_project_ref_path(@project, @ref) do Source diff --git a/app/views/refs/_submodule_item.html.haml b/app/views/refs/_submodule_item.html.haml index 6db49310..6b9f5877 100644 --- a/app/views/refs/_submodule_item.html.haml +++ b/app/views/refs/_submodule_item.html.haml @@ -1,13 +1,13 @@ - url = content.url(@ref) rescue nil - name = content.basename - return unless url -%tr{ :class => "tree-item", :url => url } +%tr{ class: "tree-item", url: url } %td.tree-item-file-name = image_tag "submodule.png" - %strong= truncate(name, :length => 40) + %strong= truncate(name, length: 40) %td %code= content.id[0..10] %td - = link_to truncate(url, :length => 40), url + = link_to truncate(url, length: 40), url diff --git a/app/views/refs/_tree.html.haml b/app/views/refs/_tree.html.haml index ba0bd691..6f8175da 100644 --- a/app/views/refs/_tree.html.haml +++ b/app/views/refs/_tree.html.haml @@ -1,7 +1,7 @@ %ul.breadcrumb %li %span.arrow - = link_to tree_project_ref_path(@project, @ref, :path => nil), :remote => true do + = link_to tree_project_ref_path(@project, @ref, path: nil), remote: true do = @project.name - tree.breadcrumbs(6) do |link| \/ @@ -10,32 +10,32 @@ %div.tree_progress #tree-content-holder - if tree.is_blob? - = render :partial => "refs/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree } + = render partial: "refs/tree_file", locals: { name: tree.name, content: tree.data, file: tree } - else - contents = tree.contents - %table#tree-slider.bordered-table.table{:class => "table_#{@hex_path}" } + %table#tree-slider.bordered-table.table{class: "table_#{@hex_path}" } %thead %th Name %th Last Update %th Last commit - = link_to "History", tree.history_path, :class => "right" + = link_to "History", tree.history_path, class: "right" - if tree.up_dir? - %tr{ :class => "tree-item", :url => tree.up_dir_path } + %tr{ class: "tree-item", url: tree.up_dir_path } %td.tree-item-file-name = image_tag "file_empty.png" - = link_to "..", tree.up_dir_path, :remote => :true + = link_to "..", tree.up_dir_path, remote: :true %td %td - index = 0 - contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content| - = render :partial => "refs/tree_item", :locals => { :content => content, :index => (index += 1) } + = render partial: "refs/tree_item", locals: { content: content, index: (index += 1) } - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| - = render :partial => "refs/tree_item", :locals => { :content => content, :index => (index += 1) } + = render partial: "refs/tree_item", locals: { content: content, index: (index += 1) } - contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content| - = render :partial => "refs/submodule_item", :locals => { :content => content, :index => (index += 1) } + = render partial: "refs/submodule_item", locals: { content: content, index: (index += 1) } - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first .file_holder#README diff --git a/app/views/refs/_tree_commit.html.haml b/app/views/refs/_tree_commit.html.haml index 2c8cd932..a5681aa2 100644 --- a/app/views/refs/_tree_commit.html.haml +++ b/app/views/refs/_tree_commit.html.haml @@ -1,3 +1,3 @@ - if tm %strong= link_to "[#{tm.user_name}]", project_team_member_path(@project, tm) -= link_to_gfm truncate(content_commit.title, :length => tm ? 30 : 50), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" += link_to_gfm truncate(content_commit.title, length: tm ? 30 : 50), project_commit_path(@project, content_commit.id), class: "tree-commit-link" diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml index d45a03df..b5ed61bb 100644 --- a/app/views/refs/_tree_file.html.haml +++ b/app/views/refs/_tree_file.html.haml @@ -5,9 +5,9 @@ = name %small #{file.mode} %span.options - = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small", :target => "_blank" - = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "btn very_small" - = link_to "blame", blame_file_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small" + = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank" + = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" + = link_to "blame", blame_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" - if file.text? - if name =~ /\.(md|markdown)$/i .file_content.wiki @@ -16,7 +16,7 @@ - else .file_content.code - unless file.empty? - %div{:class => current_user.dark_scheme ? "black" : "white"} + %div{class: current_user.dark_scheme ? "black" : "white"} = preserve do = raw file.colorize(options: { linenos: 'True'}) - else @@ -24,14 +24,14 @@ - elsif file.image? .file_content.image_file - %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + %img{ src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - else .file_content.blob_file %center - = link_to blob_project_ref_path(@project, @ref, :path => params[:path]) do + = link_to blob_project_ref_path(@project, @ref, path: params[:path]) do %div.padded %br - = image_tag "download.png", :width => 64 + = image_tag "download.png", width: 64 %h3 Download (#{file.mb_size}) diff --git a/app/views/refs/_tree_item.html.haml b/app/views/refs/_tree_item.html.haml index 4ce16b22..2e6bbf62 100644 --- a/app/views/refs/_tree_item.html.haml +++ b/app/views/refs/_tree_item.html.haml @@ -1,11 +1,11 @@ - file = tree_full_path(content) -%tr{ :class => "tree-item #{tree_hex_class(content)}", :url => tree_file_project_ref_path(@project, @ref, file) } +%tr{ class: "tree-item #{tree_hex_class(content)}", url: tree_file_project_ref_path(@project, @ref, file) } %td.tree-item-file-name = tree_icon(content) - = link_to truncate(content.name, :length => 40), tree_file_project_ref_path(@project, @ref || @commit.id, file), :remote => :true + = link_to truncate(content.name, length: 40), tree_file_project_ref_path(@project, @ref || @commit.id, file), remote: :true %td.tree_time_ago.cgray - if index == 1 %span.log_loading Loading commit data.. - = image_tag "ajax_loader_tree.gif", :width => 14 + = image_tag "ajax_loader_tree.gif", width: 14 %td.tree_commit diff --git a/app/views/refs/blame.html.haml b/app/views/refs/blame.html.haml index 6d036c94..34478d4b 100644 --- a/app/views/refs/blame.html.haml +++ b/app/views/refs/blame.html.haml @@ -4,7 +4,7 @@ %ul.breadcrumb %li %span.arrow - = link_to tree_project_ref_path(@project, @ref, :path => nil) do + = link_to tree_project_ref_path(@project, @ref, path: nil) do = @project.name - @tree.breadcrumbs(6) do |link| \/ @@ -18,9 +18,9 @@ = @tree.name %small blame %span.options - = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small", :target => "_blank" - = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "btn very_small" - = link_to "source", tree_file_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small" + = link_to "raw", blob_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small", target: "_blank" + = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" + = link_to "source", tree_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" .file_content.blame %table - @blame.each do |commit, lines| @@ -32,8 +32,8 @@ = commit.author_name %td.blame_commit   - %code= link_to commit.short_id, project_commit_path(@project, :id => commit.id) - = link_to_gfm truncate(commit.title, :length => 30), project_commit_path(@project, :id => commit.id), :class => "row_title" rescue "--broken encoding" + %code= link_to commit.short_id, project_commit_path(@project, id: commit.id) + = link_to_gfm truncate(commit.title, length: 30), project_commit_path(@project, id: commit.id), class: "row_title" rescue "--broken encoding" %td.lines = preserve do %pre diff --git a/app/views/refs/logs_tree.js.haml b/app/views/refs/logs_tree.js.haml index 402f5aa7..61ccbaee 100644 --- a/app/views/refs/logs_tree.js.haml +++ b/app/views/refs/logs_tree.js.haml @@ -6,4 +6,4 @@ :plain var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); row.find("td.tree_time_ago").html('#{escape_javascript(time_ago_in_words(content_commit.committed_date))} ago'); - row.find("td.tree_commit").html('#{escape_javascript(render("tree_commit", :tm => tm, :content_commit => content_commit))}'); + row.find("td.tree_commit").html('#{escape_javascript(render("tree_commit", tm: tm, content_commit: content_commit))}'); diff --git a/app/views/refs/tree.html.haml b/app/views/refs/tree.html.haml index b48f7f91..181be642 100644 --- a/app/views/refs/tree.html.haml +++ b/app/views/refs/tree.html.haml @@ -1,5 +1,5 @@ = render "head" -#tree-holder= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree} +#tree-holder= render partial: "tree", locals: {repo: @repo, commit: @commit, tree: @tree} :javascript $(function() { diff --git a/app/views/refs/tree.js.haml b/app/views/refs/tree.js.haml index 9cf55057..2eccf8c1 100644 --- a/app/views/refs/tree.js.haml +++ b/app/views/refs/tree.js.haml @@ -1,6 +1,6 @@ :plain // Load Files list - $("#tree-holder").html("#{escape_javascript(render(:partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}))}"); + $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {repo: @repo, commit: @commit, tree: @tree}))}"); $("#tree-content-holder").show("slide", { direction: "right" }, 150); $('.project-refs-form #path').val("#{params[:path]}"); diff --git a/app/views/repositories/_branch.html.haml b/app/views/repositories/_branch.html.haml index b67c4026..cf8558ec 100644 --- a/app/views/repositories/_branch.html.haml +++ b/app/views/repositories/_branch.html.haml @@ -2,20 +2,20 @@ - commit = CommitDecorator.decorate(commit) %tr %td - = link_to project_commits_path(@project, :ref => branch.name) do - %strong= truncate(branch.name, :length => 60) + = link_to project_commits_path(@project, ref: branch.name) do + %strong= truncate(branch.name, length: 60) - if branch.name == @project.root_ref %span.label default %td - = link_to project_commit_path(@project, :id => commit.id) do + = link_to project_commit_path(@project, id: commit.id) do %code= commit.short_id - = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = gfm truncate(commit.title, :length => 40) + = image_tag gravatar_icon(commit.author_email), class: "", width: 16 + = gfm truncate(commit.title, length: 40) %span.update-author.right = time_ago_in_words(commit.committed_date) ago %td - if can? current_user, :download_code, @project - = link_to "Download", archive_project_repository_path(@project, :ref => branch.name), :class => "visible_link download_repo_link" + = link_to "Download", archive_project_repository_path(@project, ref: branch.name), class: "visible_link download_repo_link" diff --git a/app/views/repositories/_branches_head.html.haml b/app/views/repositories/_branches_head.html.haml index 0c94f298..6afff627 100644 --- a/app/views/repositories/_branches_head.html.haml +++ b/app/views/repositories/_branches_head.html.haml @@ -1,11 +1,11 @@ = render "commits/head" %ul.nav.nav-pills - %li{:class => ("active" if current_page?(project_repository_path(@project)))} + %li{class: ("active" if current_page?(project_repository_path(@project)))} = link_to project_repository_path(@project) do Recent - %li{:class => ("active" if current_page?(project_protected_branches_path(@project)))} + %li{class: ("active" if current_page?(project_protected_branches_path(@project)))} = link_to project_protected_branches_path(@project) do Protected - %li{:class => ("active" if current_page?(branches_project_repository_path(@project)))} + %li{class: ("active" if current_page?(branches_project_repository_path(@project)))} = link_to branches_project_repository_path(@project) do All diff --git a/app/views/repositories/_feed.html.haml b/app/views/repositories/_feed.html.haml index a9b9fd00..ac4eb483 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/repositories/_feed.html.haml @@ -2,7 +2,7 @@ - commit = CommitDecorator.new(commit) %tr %td - = link_to project_commits_path(@project, :ref => commit.head.name) do + = link_to project_commits_path(@project, ref: commit.head.name) do %strong = commit.head.name - if commit.head.name == @project.root_ref @@ -12,8 +12,8 @@ %div = link_to project_commits_path(@project, commit.id) do %code= commit.short_id - = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = gfm truncate(commit.title, :length => 40) + = image_tag gravatar_icon(commit.author_email), class: "", width: 16 + = gfm truncate(commit.title, length: 40) %td %span.right.cgray = time_ago_in_words(commit.committed_date) diff --git a/app/views/repositories/branches.html.haml b/app/views/repositories/branches.html.haml index f4cf9193..45004bdf 100644 --- a/app/views/repositories/branches.html.haml +++ b/app/views/repositories/branches.html.haml @@ -9,4 +9,4 @@ %tbody - @branches.each do |branch| - = render "repositories/branch", :branch => branch + = render "repositories/branch", branch: branch diff --git a/app/views/repositories/show.html.haml b/app/views/repositories/show.html.haml index add3324e..a09cdd62 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/repositories/show.html.haml @@ -7,5 +7,5 @@ %th Last commit %th - @activities.each do |update| - = render "repositories/branch", :branch => update.head + = render "repositories/branch", branch: update.head diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml index 8db6c538..7fc2c3bf 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/repositories/tags.html.haml @@ -12,12 +12,12 @@ - commit = CommitDecorator.decorate(commit) %tr %td - %strong= link_to tag.name, project_commits_path(@project, :ref => tag.name), :class => "" + %strong= link_to tag.name, project_commits_path(@project, ref: tag.name), class: "" %td = link_to project_commit_path(@project, commit.id) do %code= commit.short_id - = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = gfm truncate(commit.title, :length => 40) + = image_tag gravatar_icon(commit.author_email), class: "", width: 16 + = gfm truncate(commit.title, length: 40) %td %span.update-author.right = time_ago_in_words(commit.committed_date) @@ -25,7 +25,7 @@   %td - if can? current_user, :download_code, @project - = link_to "Download", archive_project_repository_path(@project, :ref => tag.name), :class => "visible_link download_repo_link" + = link_to "Download", archive_project_repository_path(@project, ref: tag.name), class: "visible_link download_repo_link" - else %h3 No tags diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index b93a03af..ed9da1f0 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,10 +1,10 @@ -= form_tag search_path, :method => :get do |f| += form_tag search_path, method: :get do |f| .padded = label_tag :search do %strong Looking for .input - = text_field_tag :search, params[:search], :placeholder => "issue 143", :class => "input-xxlarge", :id => "dashboard_search" - = submit_tag 'Search', :class => "btn btn-primary" + = text_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge", id: "dashboard_search" + = submit_tag 'Search', class: "btn btn-primary" - if params[:search].present? %br %h3 @@ -41,7 +41,7 @@ = link_to [merge_request.project, merge_request] do %span.badge.badge-info ##{merge_request.id} – - %strong.term= truncate merge_request.title, :length => 50 + %strong.term= truncate merge_request.title, length: 50 %strong.right %span.label= merge_request.project.name - if @merge_requests.blank? @@ -59,7 +59,7 @@ = link_to [issue.project, issue] do %span.badge.badge-info ##{issue.id} – - %strong.term= truncate issue.title, :length => 40 + %strong.term= truncate issue.title, length: 40 %strong.right %span.label= issue.project.name - if @issues.blank? diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index c9128f64..b8d8c098 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -10,22 +10,22 @@ .clearfix = f.label :title - .input= f.text_field :title, :placeholder => "Example Snippet" + .input= f.text_field :title, placeholder: "Example Snippet" .clearfix = f.label :file_name - .input= f.text_field :file_name, :placeholder => "example.rb" + .input= f.text_field :file_name, placeholder: "example.rb" .clearfix = f.label "Lifetime" - .input= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;" + .input= f.select :expires_at, lifetime_select_options, {}, style: "width:200px;" .clearfix = f.label :content, "Code" - .input= f.text_area :content, :class => "span8" + .input= f.text_area :content, class: "span8" .actions - = f.submit 'Save', :class => "primary btn" - = link_to "Cancel", project_snippets_path(@project), :class => " btn" + = f.submit 'Save', class: "primary btn" + = link_to "Cancel", project_snippets_path(@project), class: " btn" - unless @snippet.new_record? - .right= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "btn right danger delete-snippet", :id => "destroy_snippet_#{@snippet.id}" + .right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" diff --git a/app/views/snippets/_snippet.html.haml b/app/views/snippets/_snippet.html.haml index 0385d753..a2d3a65e 100644 --- a/app/views/snippets/_snippet.html.haml +++ b/app/views/snippets/_snippet.html.haml @@ -1,7 +1,7 @@ %tr %td - %a{:href => project_snippet_path(snippet.project, snippet)} - %strong= truncate(snippet.title, :length => 60) + %a{href: project_snippet_path(snippet.project, snippet)} + %strong= truncate(snippet.title, length: 60) %td = snippet.file_name %td diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index a6b07716..2d07921e 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -2,7 +2,7 @@ - if can? current_user, :write_snippet, @project .alert-message.block-message - = link_to new_project_snippet_path(@project), :class => "btn small add_new right", :title => "New Snippet" do + = link_to new_project_snippet_path(@project), class: "btn small add_new right", title: "New Snippet" do Add new snippet Share code pastes with others if it cant be in a git repository %br @@ -17,5 +17,5 @@ = render @snippets.fresh - if @snippets.fresh.empty? %tr - %td{:colspan => 3} + %td{colspan: 3} %h3.nothing_here_message Nothing here. diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index b266e4d2..0800b81d 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -4,7 +4,7 @@ = @snippet.title %small= @snippet.file_name - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to "Edit", edit_project_snippet_path(@project, @snippet), :class => "btn small right" + = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right" %br .file_holder @@ -12,9 +12,9 @@ %i.icon-file %strong= @snippet.file_name %span.options - = link_to "raw", raw_project_snippet_path(@project, @snippet), :class => "btn very_small", :target => "_blank" + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" .file_content.code - %div{:class => current_user.dark_scheme ? "black" : ""} + %div{class: current_user.dark_scheme ? "black" : ""} = raw @snippet.colorize(options: { linenos: 'True'}) -= render "notes/notes", :tid => @snippet.id, :tt => "snippet" += render "notes/notes", tid: @snippet.id, tt: "snippet" diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index 1d882e29..208794b9 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -1,6 +1,6 @@ %h3= "New Team member" %hr -= form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member) do |f| += form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f| -if @team_member.errors.any? .alert-message.block-message.error %ul @@ -9,17 +9,17 @@ .clearfix = f.label :user_id, "Name" - .input= f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" }) + .input= f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, { style: "width:300px" }) .clearfix = f.label :project_access, "Project Access" - .input= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select" + .input= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select" .actions - = f.submit 'Save', :class => "btn primary" - = link_to "Cancel", team_project_path(@project), :class => "btn" + = f.submit 'Save', class: "btn primary" + = link_to "Cancel", team_project_path(@project), class: "btn" :css form select { diff --git a/app/views/team_members/_show.html.haml b/app/views/team_members/_show.html.haml index 9f023c41..f47554c1 100644 --- a/app/views/team_members/_show.html.haml +++ b/app/views/team_members/_show.html.haml @@ -1,6 +1,6 @@ - user = member.user - allow_admin = can? current_user, :admin_project, @project -%tr{:id => dom_id(member), :class => "team_member_row user_#{user.id}"} +%tr{id: dom_id(member), class: "team_member_row user_#{user.id}"} %td .right - if @project.owner == user @@ -8,13 +8,13 @@ - if user.blocked %span.label Blocked - = link_to project_team_member_path(@project, member), :title => user.name, :class => "dark" do - = image_tag gravatar_icon(user.email, 40), :class => "avatar" - = link_to project_team_member_path(@project, member), :title => user.name, :class => "dark" do - %strong= truncate(user.name, :lenght => 40) + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do + = image_tag gravatar_icon(user.email, 40), class: "avatar" + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do + %strong= truncate(user.name, lenght: 40) %br %div.cgray= user.email %td - = form_for(member, :as => :team_member, :url => project_team_member_path(@project, member)) do |f| - = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, :class => "medium project-access-select", :disabled => !allow_admin + = form_for(member, as: :team_member, url: project_team_member_path(@project, member)) do |f| + = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select", disabled: !allow_admin diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml index bcdb5c6f..d7e09bce 100644 --- a/app/views/team_members/show.html.haml +++ b/app/views/team_members/show.html.haml @@ -3,9 +3,9 @@ .team_member_show - if can? current_user, :admin_project, @project - = link_to 'Remove from team', project_team_member_path(:project_id => @project, :id => @team_member.id), :confirm => 'Are you sure?', :method => :delete, :class => "right btn btn-danger" + = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "right btn btn-danger" .profile_avatar_holder - = image_tag gravatar_icon(user.email, 60), :class => "borders" + = image_tag gravatar_icon(user.email, 60), class: "borders" %h3 = user.name %small @@ -14,7 +14,7 @@ %hr .back_link %br - = link_to team_project_path(@project), :class => "" do + = link_to team_project_path(@project), class: "" do ← To team list %br .row @@ -46,10 +46,10 @@ %tr %td Project Access: - %small (#{link_to "read more", help_permissions_path, :class => "vlink"}) + %small (#{link_to "read more", help_permissions_path, class: "vlink"}) %td - = form_for(@team_member, :as => :team_member, :url => project_team_member_path(@project, @team_member)) do |f| - = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select", :disabled => !allow_admin + = form_for(@team_member, as: :team_member, url: project_team_member_path(@project, @team_member)) do |f| + = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select", disabled: !allow_admin %hr = render user.recent_events.limit(5) :javascript diff --git a/app/views/wikis/_form.html.haml b/app/views/wikis/_form.html.haml index 20b5b112..6b6411be 100644 --- a/app/views/wikis/_form.html.haml +++ b/app/views/wikis/_form.html.haml @@ -9,7 +9,7 @@ .main_box .top_box_content = f.label :title - .input= f.text_field :title, :class => 'span8' + .input= f.text_field :title, class: 'span8' = f.hidden_field :slug .middle_box_content .input @@ -20,7 +20,7 @@ .bottom_box_content = f.label :content - .input= f.text_area :content, :class => 'span8' + .input= f.text_area :content, class: 'span8' .actions - = f.submit 'Save', :class => "primary btn" - = link_to "Cancel", project_wiki_path(@project, :index), :class => "btn" + = f.submit 'Save', class: "primary btn" + = link_to "Cancel", project_wiki_path(@project, :index), class: "btn" diff --git a/app/views/wikis/history.html.haml b/app/views/wikis/history.html.haml index f82c681f..e31c5dc2 100644 --- a/app/views/wikis/history.html.haml +++ b/app/views/wikis/history.html.haml @@ -13,7 +13,7 @@ %tr %td= i + 1 %td - = link_to wiki_page.created_at.to_s(:short), project_wiki_path(@project, wiki_page, :old_page_id => wiki_page.id) + = link_to wiki_page.created_at.to_s(:short), project_wiki_path(@project, wiki_page, old_page_id: wiki_page.id) (#{time_ago_in_words(wiki_page.created_at)} ago) %td= wiki_page.user.name diff --git a/app/views/wikis/pages.html.haml b/app/views/wikis/pages.html.haml index c8462119..2bfd0deb 100644 --- a/app/views/wikis/pages.html.haml +++ b/app/views/wikis/pages.html.haml @@ -10,7 +10,7 @@ - @wikis.each_with_index do |wiki_page, i| %tr %td - = link_to wiki_page.title, project_wiki_path(@project, wiki_page, :old_page_id => wiki_page.id) + = link_to wiki_page.title, project_wiki_path(@project, wiki_page, old_page_id: wiki_page.id) (#{time_ago_in_words(wiki_page.created_at)} ago) %td= wiki_page.slug diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml index 579aeb41..fc235227 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/wikis/show.html.haml @@ -1,12 +1,12 @@ %h3.page_title = @wiki.title %span.right - = link_to pages_project_wikis_path(@project), :class => "btn small grouped" do + = link_to pages_project_wikis_path(@project), class: "btn small grouped" do Pages - if can? current_user, :write_wiki, @project - = link_to history_project_wiki_path(@project, @wiki), :class => "btn small grouped" do + = link_to history_project_wiki_path(@project, @wiki), class: "btn small grouped" do History - = link_to edit_project_wiki_path(@project, @wiki), :class => "btn small grouped" do + = link_to edit_project_wiki_path(@project, @wiki), class: "btn small grouped" do %i.icon-edit Edit %br @@ -17,8 +17,8 @@ %p.time Last edited by #{@wiki.user.name}, #{time_ago_in_words @wiki.created_at} ago - if can? current_user, :admin_wiki, @project - = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do + = link_to project_wiki_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete do Delete this page %hr -.wiki_notes#notes= render "notes/notes", :tid => @wiki.id, :tt => "wiki" +.wiki_notes#notes= render "notes/notes", tid: @wiki.id, tt: "wiki" diff --git a/lib/api.rb b/lib/api.rb index 6a8a3d65..3ff3b383 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -3,7 +3,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file} module Gitlab class API < Grape::API VERSION = 'v2' - version VERSION, :using => :path + version VERSION, using: :path rescue_from ActiveRecord::RecordNotFound do rack_response({'message' => '404 Not found'}.to_json, 404) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index d86fb79c..96ccd87a 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -11,8 +11,8 @@ module Gitlab class Project < Grape::Entity expose :id, :code, :name, :description, :path, :default_branch - expose :owner, :using => Entities::UserBasic - expose :private_flag, :as => :private + expose :owner, using: Entities::UserBasic + expose :private_flag, as: :private expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at end @@ -22,7 +22,7 @@ module Gitlab class ProjectSnippet < Grape::Entity expose :id, :title, :file_name - expose :author, :using => Entities::UserBasic + expose :author, using: Entities::UserBasic expose :expires_at, :updated_at, :created_at end @@ -34,9 +34,9 @@ module Gitlab expose :id expose (:project_id) {|issue| issue.project.id} expose :title, :description - expose :label_list, :as => :labels - expose :milestone, :using => Entities::Milestone - expose :assignee, :author, :using => Entities::UserBasic + expose :label_list, as: :labels + expose :milestone, using: Entities::Milestone + expose :assignee, :author, using: Entities::UserBasic expose :closed, :updated_at, :created_at end end diff --git a/lib/api/issues.rb b/lib/api/issues.rb index dcb6e535..2abc20ad 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -9,7 +9,7 @@ module Gitlab # Example Request: # GET /issues get do - present current_user.issues, :with => Entities::Issue + present current_user.issues, with: Entities::Issue end end @@ -21,7 +21,7 @@ module Gitlab # Example Request: # GET /projects/:id/issues get ":id/issues" do - present user_project.issues, :with => Entities::Issue + present user_project.issues, with: Entities::Issue end # Get a single project issue @@ -33,7 +33,7 @@ module Gitlab # GET /projects/:id/issues/:issue_id get ":id/issues/:issue_id" do @issue = user_project.issues.find(params[:issue_id]) - present @issue, :with => Entities::Issue + present @issue, with: Entities::Issue end # Create a new project issue @@ -49,16 +49,16 @@ module Gitlab # POST /projects/:id/issues post ":id/issues" do @issue = user_project.issues.new( - :title => params[:title], - :description => params[:description], - :assignee_id => params[:assignee_id], - :milestone_id => params[:milestone_id], - :label_list => params[:labels] + title: params[:title], + description: params[:description], + assignee_id: params[:assignee_id], + milestone_id: params[:milestone_id], + label_list: params[:labels] ) @issue.author = current_user if @issue.save - present @issue, :with => Entities::Issue + present @issue, with: Entities::Issue else error!({'message' => '404 Not found'}, 404) end @@ -80,16 +80,16 @@ module Gitlab put ":id/issues/:issue_id" do @issue = user_project.issues.find(params[:issue_id]) parameters = { - :title => (params[:title] || @issue.title), - :description => (params[:description] || @issue.description), - :assignee_id => (params[:assignee_id] || @issue.assignee_id), - :milestone_id => (params[:milestone_id] || @issue.milestone_id), - :label_list => (params[:labels] || @issue.label_list), - :closed => (params[:closed] || @issue.closed) + title: (params[:title] || @issue.title), + description: (params[:description] || @issue.description), + assignee_id: (params[:assignee_id] || @issue.assignee_id), + milestone_id: (params[:milestone_id] || @issue.milestone_id), + label_list: (params[:labels] || @issue.label_list), + closed: (params[:closed] || @issue.closed) } if @issue.update_attributes(parameters) - present @issue, :with => Entities::Issue + present @issue, with: Entities::Issue else error!({'message' => '404 Not found'}, 404) end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 31bc7d88..eb23641c 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -10,7 +10,7 @@ module Gitlab # GET /projects get do @projects = current_user.projects - present @projects, :with => Entities::Project + present @projects, with: Entities::Project end # Get a single project @@ -20,7 +20,7 @@ module Gitlab # Example Request: # GET /projects/:id get ":id" do - present user_project, :with => Entities::Project + present user_project, with: Entities::Project end # Get a project repository branches @@ -30,7 +30,7 @@ module Gitlab # Example Request: # GET /projects/:id/repository/branches get ":id/repository/branches" do - present user_project.repo.heads.sort_by(&:name), :with => Entities::RepoObject + present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject end # Get a single branch @@ -42,7 +42,7 @@ module Gitlab # GET /projects/:id/repository/branches/:branch get ":id/repository/branches/:branch" do @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } - present @branch, :with => Entities::RepoObject + present @branch, with: Entities::RepoObject end # Get a project repository tags @@ -52,7 +52,7 @@ module Gitlab # Example Request: # GET /projects/:id/repository/tags get ":id/repository/tags" do - present user_project.repo.tags.sort_by(&:name).reverse, :with => Entities::RepoObject + present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject end # Get a project snippet @@ -64,7 +64,7 @@ module Gitlab # GET /projects/:id/snippets/:snippet_id get ":id/snippets/:snippet_id" do @snippet = user_project.snippets.find(params[:snippet_id]) - present @snippet, :with => Entities::ProjectSnippet + present @snippet, with: Entities::ProjectSnippet end # Create a new project snippet @@ -79,15 +79,15 @@ module Gitlab # POST /projects/:id/snippets post ":id/snippets" do @snippet = user_project.snippets.new( - :title => params[:title], - :file_name => params[:file_name], - :expires_at => params[:lifetime], - :content => params[:code] + title: params[:title], + file_name: params[:file_name], + expires_at: params[:lifetime], + content: params[:code] ) @snippet.author = current_user if @snippet.save - present @snippet, :with => Entities::ProjectSnippet + present @snippet, with: Entities::ProjectSnippet else error!({'message' => '404 Not found'}, 404) end @@ -107,14 +107,14 @@ module Gitlab put ":id/snippets/:snippet_id" do @snippet = user_project.snippets.find(params[:snippet_id]) parameters = { - :title => (params[:title] || @snippet.title), - :file_name => (params[:file_name] || @snippet.file_name), - :expires_at => (params[:lifetime] || @snippet.expires_at), - :content => (params[:code] || @snippet.content) + title: (params[:title] || @snippet.title), + file_name: (params[:file_name] || @snippet.file_name), + expires_at: (params[:lifetime] || @snippet.expires_at), + content: (params[:code] || @snippet.content) } if @snippet.update_attributes(parameters) - present @snippet, :with => Entities::ProjectSnippet + present @snippet, with: Entities::ProjectSnippet else error!({'message' => '404 Not found'}, 404) end diff --git a/lib/api/users.rb b/lib/api/users.rb index ef3762f3..81cb2a0e 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -10,7 +10,7 @@ module Gitlab # GET /users get do @users = User.all - present @users, :with => Entities::User + present @users, with: Entities::User end # Get a single user @@ -21,7 +21,7 @@ module Gitlab # GET /users/:id get ":id" do @user = User.find(params[:id]) - present @user, :with => Entities::User + present @user, with: Entities::User end end @@ -30,7 +30,7 @@ module Gitlab # Example Request: # GET /user get "/user" do - present @current_user, :with => Entities::User + present @current_user, with: Entities::User end end end diff --git a/lib/file_size_validator.rb b/lib/file_size_validator.rb index 611e584f..42970c1b 100644 --- a/lib/file_size_validator.rb +++ b/lib/file_size_validator.rb @@ -1,6 +1,6 @@ class FileSizeValidator < ActiveModel::EachValidator - MESSAGES = { :is => :wrong_size, :minimum => :size_too_small, :maximum => :size_too_big }.freeze - CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze + MESSAGES = { is: :wrong_size, minimum: :size_too_small, maximum: :size_too_big }.freeze + CHECKS = { is: :==, minimum: :>=, maximum: :<= }.freeze DEFAULT_TOKENIZER = lambda { |value| value.split(//) } RESERVED_OPTIONS = [:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long] diff --git a/lib/gitlab/encode.rb b/lib/gitlab/encode.rb index 0787434b..7e37442e 100644 --- a/lib/gitlab/encode.rb +++ b/lib/gitlab/encode.rb @@ -19,7 +19,7 @@ module Gitlab # if message is not utf-8 encoding, convert it if detect[:encoding] message.force_encoding(detect[:encoding]) - message.encode!("utf-8", detect[:encoding], :undef => :replace, :replace => "", :invalid => :replace) + message.encode!("utf-8", detect[:encoding], undef: :replace, replace: "", invalid: :replace) end # ensure message encoding is utf8 diff --git a/lib/graph_commit.rb b/lib/graph_commit.rb index 269378e8..e08a8fad 100644 --- a/lib/graph_commit.rb +++ b/lib/graph_commit.rb @@ -6,7 +6,7 @@ class GraphCommit def self.to_graph(project) @repo = project.repo - commits = Grit::Commit.find_all(@repo, nil, {:max_count => 650}) + commits = Grit::Commit.find_all(@repo, nil, {max_count: 650}) ref_cache = {} diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 33403ded..30a80714 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -11,9 +11,9 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML def block_code(code, language) if Pygments::Lexer.find(language) - Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'}) + Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'}) else - Pygments.highlight(code, :options => {:encoding => 'utf-8'}) + Pygments.highlight(code, options: {encoding: 'utf-8'}) end end diff --git a/spec/api/issues_spec.rb b/spec/api/issues_spec.rb index d81a07e2..f6d8e379 100644 --- a/spec/api/issues_spec.rb +++ b/spec/api/issues_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Gitlab::API do let(:user) { Factory :user } - let!(:project) { Factory :project, :owner => user } - let!(:issue) { Factory :issue, :author => user, :assignee => user, :project => project } + let!(:project) { Factory :project, owner: user } + let!(:issue) { Factory :issue, author: user, assignee: user, project: project } before { project.add_access(user, :read) } describe "GET /issues" do @@ -42,7 +42,7 @@ describe Gitlab::API do describe "POST /projects/:id/issues" do it "should create a new project issue" do post "#{api_prefix}/projects/#{project.code}/issues?private_token=#{user.private_token}", - :title => 'new issue', :labels => 'label, label2' + title: 'new issue', labels: 'label, label2' response.status.should == 201 json_response['title'].should == 'new issue' json_response['description'].should be_nil @@ -53,7 +53,7 @@ describe Gitlab::API do describe "PUT /projects/:id/issues/:issue_id" do it "should update a project issue" do put "#{api_prefix}/projects/#{project.code}/issues/#{issue.id}?private_token=#{user.private_token}", - :title => 'updated title', :labels => 'label2', :closed => 1 + title: 'updated title', labels: 'label2', closed: 1 response.status.should == 200 json_response['title'].should == 'updated title' json_response['labels'].should == ['label2'] diff --git a/spec/api/projects_spec.rb b/spec/api/projects_spec.rb index 2b50b6d0..ff45619e 100644 --- a/spec/api/projects_spec.rb +++ b/spec/api/projects_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Gitlab::API do let(:user) { Factory :user } - let!(:project) { Factory :project, :owner => user } - let!(:snippet) { Factory :snippet, :author => user, :project => project, :title => 'example' } + let!(:project) { Factory :project, owner: user } + let!(:snippet) { Factory :snippet, author: user, project: project, title: 'example' } before { project.add_access(user, :read) } describe "GET /projects" do @@ -83,7 +83,7 @@ describe Gitlab::API do describe "POST /projects/:id/snippets" do it "should create a new project snippet" do post "#{api_prefix}/projects/#{project.code}/snippets?private_token=#{user.private_token}", - :title => 'api test', :file_name => 'sample.rb', :code => 'test' + title: 'api test', file_name: 'sample.rb', code: 'test' response.status.should == 201 json_response['title'].should == 'api test' end @@ -92,7 +92,7 @@ describe Gitlab::API do describe "PUT /projects/:id/snippets" do it "should update an existing project snippet" do put "#{api_prefix}/projects/#{project.code}/snippets/#{snippet.id}?private_token=#{user.private_token}", - :code => 'updated code' + code: 'updated code' response.status.should == 200 json_response['title'].should == 'example' snippet.reload.content.should == 'updated code' diff --git a/spec/helpers/gitlab_flavored_markdown_spec.rb b/spec/helpers/gitlab_flavored_markdown_spec.rb index 15fd2180..e147cb39 100644 --- a/spec/helpers/gitlab_flavored_markdown_spec.rb +++ b/spec/helpers/gitlab_flavored_markdown_spec.rb @@ -5,8 +5,8 @@ describe GitlabMarkdownHelper do @project = Project.find_by_path("gitlabhq") || Factory(:project) @commit = @project.repo.commits.first.parents.first @commit = CommitDecorator.decorate(Commit.new(@commit)) - @other_project = Factory :project, :path => "OtherPath", :code => "OtherCode" - @fake_user = Factory :user, :name => "fred" + @other_project = Factory :project, path: "OtherPath", code: "OtherCode" + @fake_user = Factory :user, name: "fred" end describe "#gfm" do @@ -18,15 +18,15 @@ describe GitlabMarkdownHelper do describe "referencing a commit" do it "should link using a full id" do - gfm("Reverts changes from #{@commit.id}").should == "Reverts changes from #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Reverts changes from #{@commit.id}").should == "Reverts changes from #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end it "should link using a short id" do - gfm("Backported from #{@commit.id[0, 6]}").should == "Backported from #{link_to @commit.id[0, 6], project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Backported from #{@commit.id[0, 6]}").should == "Backported from #{link_to @commit.id[0, 6], project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end it "should link with adjecent text" do - gfm("Reverted (see #{@commit.id})").should == "Reverted (see #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "})" + gfm("Reverted (see #{@commit.id})").should == "Reverted (see #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "})" end it "should not link with an invalid id" do @@ -38,33 +38,33 @@ describe GitlabMarkdownHelper do it "should link using a simple name" do user = Factory :user, name: "barry" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link using a name with dots" do user = Factory :user, name: "alphA.Beta" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link using name with underscores" do user = Factory :user, name: "ping_pong_king" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link with adjecent text" do - user = Factory.create(:user, :name => "ace") + user = Factory.create(:user, name: "ace") @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("Mail the Admin (@#{user.name})").should == "Mail the Admin (#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "})" + gfm("Mail the Admin (@#{user.name})").should == "Mail the Admin (#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "})" end it "should add styles" do @@ -80,16 +80,16 @@ describe GitlabMarkdownHelper do describe "referencing an issue" do before do - @issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project - @invalid_issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @other_project + @issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @project + @invalid_issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @other_project end it "should link using a correct id" do - gfm("Fixes ##{@issue.id}").should == "Fixes #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "}" + gfm("Fixes ##{@issue.id}").should == "Fixes #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "}" end it "should link with adjecent text" do - gfm("This has already been discussed (see ##{@issue.id})").should == "This has already been discussed (see #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "})" + gfm("This has already been discussed (see ##{@issue.id})").should == "This has already been discussed (see #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "})" end it "should add styles" do @@ -103,16 +103,16 @@ describe GitlabMarkdownHelper do describe "referencing a merge request" do before do - @merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @project - @invalid_merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @other_project + @merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @project + @invalid_merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @other_project end it "should link using a correct id" do - gfm("Fixed in !#{@merge_request.id}").should == "Fixed in #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "}" + gfm("Fixed in !#{@merge_request.id}").should == "Fixed in #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "}" end it "should link with adjecent text" do - gfm("This has been fixed already (see !#{@merge_request.id})").should == "This has been fixed already (see #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "})" + gfm("This has been fixed already (see !#{@merge_request.id})").should == "This has been fixed already (see #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "})" end it "should add styles" do @@ -127,17 +127,17 @@ describe GitlabMarkdownHelper do describe "referencing a snippet" do before do @snippet = Factory.create(:snippet, - :title => "Render asset to string", - :author => @fake_user, - :project => @project) + title: "Render asset to string", + author: @fake_user, + project: @project) end it "should link using a correct id" do - gfm("Check out $#{@snippet.id}").should == "Check out #{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), :title => "Snippet: #{@snippet.title}", :class => "gfm gfm-snippet "}" + gfm("Check out $#{@snippet.id}").should == "Check out #{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), title: "Snippet: #{@snippet.title}", class: "gfm gfm-snippet "}" end it "should link with adjecent text" do - gfm("I have created a snippet for that ($#{@snippet.id})").should == "I have created a snippet for that (#{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), :title => "Snippet: #{@snippet.title}", :class => "gfm gfm-snippet "})" + gfm("I have created a snippet for that ($#{@snippet.id})").should == "I have created a snippet for that (#{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), title: "Snippet: #{@snippet.title}", class: "gfm gfm-snippet "})" end it "should add styles" do @@ -152,12 +152,12 @@ describe GitlabMarkdownHelper do it "should link to multiple things" do user = Factory :user, name: "barry" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("Let @#{user.name} fix the *mess* in #{@commit.id}").should == "Let #{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} fix the *mess* in #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Let @#{user.name} fix the *mess* in #{@commit.id}").should == "Let #{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} fix the *mess* in #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end - it "should not trip over other stuff", :focus => true do + it "should not trip over other stuff", focus: true do gfm("_Please_ *stop* 'helping' and all the other b*$#%' you do.").should == "_Please_ *stop* 'helping' and all the other b*$#%' you do." end @@ -166,57 +166,57 @@ describe GitlabMarkdownHelper do end it "should forward HTML options to links" do - gfm("fixed in #{@commit.id}", :class => "foo").should have_selector("a.foo") + gfm("fixed in #{@commit.id}", class: "foo").should have_selector("a.foo") end end describe "#link_to_gfm" do - let(:issue1) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } - let(:issue2) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } + let(:issue1) { Factory :issue, assignee: @fake_user, author: @fake_user, project: @project } + let(:issue2) { Factory :issue, assignee: @fake_user, author: @fake_user, project: @project } it "should handle references nested in links with all the text" do - link_to_gfm("This should finally fix ##{issue1.id} and ##{issue2.id} for real", project_commit_path(@project, :id => @commit.id)).should == "#{link_to "This should finally fix ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue1.id}", project_issue_path(@project, issue1), :title => "Issue: #{issue1.title}", :class => "gfm gfm-issue "}#{link_to " and ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue2.id}", project_issue_path(@project, issue2), :title => "Issue: #{issue2.title}", :class => "gfm gfm-issue "}#{link_to " for real", project_commit_path(@project, :id => @commit.id)}" + link_to_gfm("This should finally fix ##{issue1.id} and ##{issue2.id} for real", project_commit_path(@project, id: @commit.id)).should == "#{link_to "This should finally fix ", project_commit_path(@project, id: @commit.id)}#{link_to "##{issue1.id}", project_issue_path(@project, issue1), title: "Issue: #{issue1.title}", class: "gfm gfm-issue "}#{link_to " and ", project_commit_path(@project, id: @commit.id)}#{link_to "##{issue2.id}", project_issue_path(@project, issue2), title: "Issue: #{issue2.title}", class: "gfm gfm-issue "}#{link_to " for real", project_commit_path(@project, id: @commit.id)}" end it "should forward HTML options" do - link_to_gfm("This should finally fix ##{issue1.id} for real", project_commit_path(@project, :id => @commit.id), :class => "foo").should have_selector(".foo") + link_to_gfm("This should finally fix ##{issue1.id} for real", project_commit_path(@project, id: @commit.id), class: "foo").should have_selector(".foo") end end describe "#markdown" do before do - @issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project - @merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @project + @issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @project + @merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @project @note = Factory.create(:note, - :note => "Screenshot of the new feature", - :project => @project, - :noteable_id => @commit.id, - :noteable_type => "Commit", - :attachment => "screenshot123.jpg") + note: "Screenshot of the new feature", + project: @project, + noteable_id: @commit.id, + noteable_type: "Commit", + attachment: "screenshot123.jpg") @snippet = Factory.create(:snippet, - :title => "Render asset to string", - :author => @fake_user, - :project => @project) + title: "Render asset to string", + author: @fake_user, + project: @project) @other_user = Factory :user, name: "bill" @project.users << @other_user - @member = @project.users_projects.where(:user_id => @other_user).first + @member = @project.users_projects.where(user_id: @other_user).first end it "should handle references in paragraphs" do - markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{@commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should == "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.

\n" + markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{@commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should == "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.

\n" end it "should handle references in headers" do - markdown("\n# Working around ##{@issue.id} for now\n## Apply !#{@merge_request.id}").should == "

Working around #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "} for now

\n\n

Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "}

\n" + markdown("\n# Working around ##{@issue.id} for now\n## Apply !#{@merge_request.id}").should == "

Working around #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "} for now

\n\n

Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "}

\n" end it "should handle references in lists" do - markdown("\n* dark: ##{@issue.id}\n* light by @#{@other_user.name}\n").should == "\n" + markdown("\n* dark: ##{@issue.id}\n* light by @#{@other_user.name}\n").should == "\n" end it "should handle references in " do - markdown("Apply _!#{@merge_request.id}_ ASAP").should == "

Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "} ASAP

\n" + markdown("Apply _!#{@merge_request.id}_ ASAP").should == "

Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "} ASAP

\n" end it "should leave code blocks untouched" do diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 010f063a..27af1e38 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -4,7 +4,7 @@ describe Notify do include EmailSpec::Helpers include EmailSpec::Matchers - let(:recipient) { Factory.create(:user, :email => 'recipient@example.com') } + let(:recipient) { Factory.create(:user, email: 'recipient@example.com') } let(:project) { Factory.create(:project) } shared_examples 'a multiple recipients email' do @@ -15,7 +15,7 @@ describe Notify do describe 'for new users, the email' do let(:example_site_path) { root_path } - let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') } + let(:new_user) { Factory.create(:user, email: 'newguy@example.com') } subject { Notify.new_user_email(new_user.id, new_user.password) } @@ -42,8 +42,8 @@ describe Notify do context 'for a project' do describe 'items that are assignable, the email' do - let(:assignee) { Factory.create(:user, :email => 'assignee@example.com') } - let(:previous_assignee) { Factory.create(:user, :name => 'Previous Assignee') } + let(:assignee) { Factory.create(:user, email: 'assignee@example.com') } + let(:previous_assignee) { Factory.create(:user, name: 'Previous Assignee') } shared_examples 'an assignee email' do it 'is sent to the assignee' do @@ -52,7 +52,7 @@ describe Notify do end context 'for issues' do - let(:issue) { Factory.create(:issue, :assignee => assignee, :project => project ) } + let(:issue) { Factory.create(:issue, assignee: assignee, project: project ) } describe 'that are new' do subject { Notify.new_issue_email(issue.id) } @@ -94,7 +94,7 @@ describe Notify do end context 'for merge requests' do - let(:merge_request) { Factory.create(:merge_request, :assignee => assignee, :project => project) } + let(:merge_request) { Factory.create(:merge_request, assignee: assignee, project: project) } describe 'that are new' do subject { Notify.new_merge_request_email(merge_request.id) } @@ -146,8 +146,8 @@ describe Notify do end context 'items that are noteable, the email for a note' do - let(:note_author) { Factory.create(:user, :name => 'author_name') } - let(:note) { Factory.create(:note, :project => project, :author => note_author) } + let(:note_author) { Factory.create(:user, name: 'author_name') } + let(:note) { Factory.create(:note, project: project, author: note_author) } before :each do Note.stub(:find).with(note.id).and_return(note) @@ -168,7 +168,7 @@ describe Notify do end describe 'on a project wall' do - let(:note_on_the_wall_path) { wall_project_path(project, :anchor => "note_#{note.id}") } + let(:note_on_the_wall_path) { wall_project_path(project, anchor: "note_#{note.id}") } subject { Notify.note_wall_email(recipient.id, note.id) } @@ -208,8 +208,8 @@ describe Notify do end describe 'on a merge request' do - let(:merge_request) { Factory.create(:merge_request, :project => project) } - let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, :anchor => "note_#{note.id}") } + let(:merge_request) { Factory.create(:merge_request, project: project) } + let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, anchor: "note_#{note.id}") } before(:each) { note.stub(:noteable).and_return(merge_request) } subject { Notify.note_merge_request_email(recipient.id, note.id) } @@ -226,8 +226,8 @@ describe Notify do end describe 'on an issue' do - let(:issue) { Factory.create(:issue, :project => project) } - let(:note_on_issue_path) { project_issue_path(project, issue, :anchor => "note_#{note.id}") } + let(:issue) { Factory.create(:issue, project: project) } + let(:note_on_issue_path) { project_issue_path(project, issue, anchor: "note_#{note.id}") } before(:each) { note.stub(:noteable).and_return(issue) } subject { Notify.note_issue_email(recipient.id, note.id) } diff --git a/spec/models/activity_observer_spec.rb b/spec/models/activity_observer_spec.rb index aed1b26d..0db4a998 100644 --- a/spec/models/activity_observer_spec.rb +++ b/spec/models/activity_observer_spec.rb @@ -11,7 +11,7 @@ describe ActivityObserver do describe "Merge Request created" do before do MergeRequest.observers.enable :activity_observer do - @merge_request = Factory :merge_request, :project => project + @merge_request = Factory :merge_request, project: project @event = Event.last end end @@ -24,7 +24,7 @@ describe ActivityObserver do describe "Issue created" do before do Issue.observers.enable :activity_observer do - @issue = Factory :issue, :project => project + @issue = Factory :issue, project: project @event = Event.last end end @@ -36,8 +36,8 @@ describe ActivityObserver do #describe "Issue commented" do #before do - #@issue = Factory :issue, :project => project - #@note = Factory :note, :noteable => @issue, :project => project + #@issue = Factory :issue, project: project + #@note = Factory :note, noteable: @issue, project: project #@event = Event.last #end diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index a295e286..188f0997 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -45,25 +45,25 @@ describe Event do @user = project.owner data = { - :before => "0000000000000000000000000000000000000000", - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - :ref => "refs/heads/master", - :user_id => @user.id, - :user_name => @user.name, - :repository => { - :name => project.name, - :url => "localhost/rubinius", - :description => "", - :homepage => "localhost/rubinius", - :private => true + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/master", + user_id: @user.id, + user_name: @user.name, + repository: { + name: project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true } } @event = Event.create( - :project => project, - :action => Event::Pushed, - :data => data, - :author_id => @user.id + project: project, + action: Event::Pushed, + data: data, + author_id: @user.id ) end diff --git a/spec/models/issue_observer_spec.rb b/spec/models/issue_observer_spec.rb index 2b9798f7..c6a405f1 100644 --- a/spec/models/issue_observer_spec.rb +++ b/spec/models/issue_observer_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' describe IssueObserver do - let(:some_user) { double(:user, :id => 1) } - let(:assignee) { double(:user, :id => 2) } - let(:issue) { double(:issue, :id => 42, :assignee => assignee) } + let(:some_user) { double(:user, id: 1) } + let(:assignee) { double(:user, id: 2) } + let(:issue) { double(:issue, id: 42, assignee: assignee) } before(:each) { subject.stub(:current_user).and_return(some_user) } @@ -15,13 +15,13 @@ describe IssueObserver do subject.should_receive(:after_create) Issue.observers.enable :issue_observer do - Factory.create(:issue, :project => Factory.create(:project)) + Factory.create(:issue, project: Factory.create(:project)) end end it 'sends an email to the assignee' do Notify.should_receive(:new_issue_email).with(issue.id). - and_return(double(:deliver => true)) + and_return(double(deliver: true)) subject.after_create(issue) end @@ -42,7 +42,7 @@ describe IssueObserver do end it 'is called when an issue is changed' do - changed = Factory.create(:issue, :project => Factory.create(:project)) + changed = Factory.create(:issue, project: Factory.create(:project)) subject.should_receive(:after_update) Issue.observers.enable :issue_observer do @@ -101,7 +101,7 @@ describe IssueObserver do end describe '#send_reassigned_email' do - let(:previous_assignee) { double(:user, :id => 3) } + let(:previous_assignee) { double(:user, id: 3) } before(:each) do issue.stub(:assignee_id).and_return(assignee.id) @@ -110,7 +110,7 @@ describe IssueObserver do def it_sends_a_reassigned_email_to(recipient) Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id). - and_return(double(:deliver => true)) + and_return(double(deliver: true)) end def it_does_not_send_a_reassigned_email_to(recipient) diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 806b8ee7..e9cbd725 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -20,9 +20,9 @@ describe Issue do end subject { Factory.create(:issue, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) } + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) } it { should be_valid } describe '#is_being_reassigned?' do @@ -42,10 +42,10 @@ describe Issue do end it 'returns false if the closed attribute has changed and is now false' do issue = Factory.create(:issue, - :closed => true, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) + closed: true, + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) issue.closed = false issue.is_being_closed?.should be_false end @@ -58,10 +58,10 @@ describe Issue do describe '#is_being_reopened?' do it 'returns true if the closed attribute has changed and is now false' do issue = Factory.create(:issue, - :closed => true, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) + closed: true, + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) issue.closed = false issue.is_being_reopened?.should be_true end @@ -78,9 +78,9 @@ describe Issue do let(:project) { Factory(:project) } subject { Factory.create(:issue, - :author => Factory(:user), - :assignee => Factory(:user), - :project => project) + author: Factory(:user), + assignee: Factory(:user), + project: project) } it "with no notes has a 0/0 score" do @@ -107,8 +107,8 @@ describe Issue do end describe ".search" do - let!(:issue) { Factory.create(:issue, :title => "Searchable issue", - :project => Factory.create(:project)) } + let!(:issue) { Factory.create(:issue, title: "Searchable issue", + project: Factory.create(:project)) } it "matches by title" do Issue.search('able').all.should == [issue] diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 4ef6becf..c7ad08a1 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -21,17 +21,17 @@ describe MergeRequest do end it { Factory.create(:merge_request, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)).should be_valid } + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)).should be_valid } describe "plus 1" do let(:project) { Factory(:project) } subject { Factory.create(:merge_request, - :author => Factory(:user), - :assignee => Factory(:user), - :project => project) + author: Factory(:user), + assignee: Factory(:user), + project: project) } it "with no notes has a 0/0 score" do @@ -58,8 +58,8 @@ describe MergeRequest do end describe ".search" do - let!(:issue) { Factory.create(:issue, :title => "Searchable issue", - :project => Factory.create(:project)) } + let!(:issue) { Factory.create(:issue, title: "Searchable issue", + project: Factory.create(:project)) } it "matches by title" do Issue.search('able').all.should == [issue] diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index bb71ca99..880d3f30 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -26,8 +26,8 @@ describe Milestone do end let(:project) { Factory :project } - let(:milestone) { Factory :milestone, :project => project } - let(:issue) { Factory :issue, :project => project } + let(:milestone) { Factory :milestone, project: project } + let(:issue) { Factory :issue, project: project } it { milestone.should be_valid } @@ -39,14 +39,14 @@ describe Milestone do it { milestone.percent_complete.should == 0 } it do - issue.update_attributes :closed => true + issue.update_attributes closed: true milestone.percent_complete.should == 100 end end describe :expires_at do before do - milestone.update_attributes :due_date => Date.today + 1.day + milestone.update_attributes due_date: Date.today + 1.day end it { milestone.expires_at.should_not be_nil } diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index f2dfcabc..c97b23cb 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -14,7 +14,7 @@ describe Note do end it { Factory.create(:note, - :project => project).should be_valid } + project: project).should be_valid } describe "Scopes" do it "should have a today named scope that returns ..." do Note.today.where_values.should == ["created_at >= '#{Date.today}'"] @@ -44,9 +44,9 @@ describe Note do before do @note = Factory :note, - :project => project, - :noteable_id => commit.id, - :noteable_type => "Commit" + project: project, + noteable_id: commit.id, + noteable_type: "Commit" end it "should save a valid note" do @@ -58,10 +58,10 @@ describe Note do describe "Pre-line commit notes" do before do @note = Factory :note, - :project => project, - :noteable_id => commit.id, - :noteable_type => "Commit", - :line_code => "0_16_1" + project: project, + noteable_id: commit.id, + noteable_type: "Commit", + line_code: "0_16_1" end it "should save a valid note" do @@ -72,7 +72,7 @@ describe Note do describe '#create_status_change_note' do let(:project) { Factory.create(:project) } - let(:thing) { Factory.create(:issue, :project => project) } + let(:thing) { Factory.create(:issue, project: project) } let(:author) { Factory(:user) } let(:status) { 'new_status' } @@ -92,7 +92,7 @@ describe Note do describe :authorization do before do @p1 = project - @p2 = Factory :project, :code => "alien", :path => "gitlabhq_1" + @p2 = Factory :project, code: "alien", path: "gitlabhq_1" @u1 = Factory :user @u2 = Factory :user @u3 = Factory :user @@ -102,8 +102,8 @@ describe Note do describe :read do before do - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::GUEST) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::GUEST) + @p1.users_projects.create(user: @u2, project_access: UsersProject::GUEST) + @p2.users_projects.create(user: @u3, project_access: UsersProject::GUEST) end it { @abilities.allowed?(@u1, :read_note, @p1).should be_false } @@ -113,8 +113,8 @@ describe Note do describe :write do before do - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::DEVELOPER) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::DEVELOPER) + @p1.users_projects.create(user: @u2, project_access: UsersProject::DEVELOPER) + @p2.users_projects.create(user: @u3, project_access: UsersProject::DEVELOPER) end it { @abilities.allowed?(@u1, :write_note, @p1).should be_false } @@ -124,9 +124,9 @@ describe Note do describe :admin do before do - @p1.users_projects.create(:user => @u1, :project_access => UsersProject::REPORTER) - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::MASTER) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::MASTER) + @p1.users_projects.create(user: @u1, project_access: UsersProject::REPORTER) + @p1.users_projects.create(user: @u2, project_access: UsersProject::MASTER) + @p2.users_projects.create(user: @u3, project_access: UsersProject::MASTER) end it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false } diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb index 5544c5a8..129e3d61 100644 --- a/spec/models/project_hooks_spec.rb +++ b/spec/models/project_hooks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Project, "Hooks" do let(:project) { Factory :project } before do - @key = Factory :key, :user => project.owner + @key = Factory :key, user: project.owner @user = @key.user @key_id = @key.identifier end diff --git a/spec/models/project_security_spec.rb b/spec/models/project_security_spec.rb index bd697af9..baf6d4b6 100644 --- a/spec/models/project_security_spec.rb +++ b/spec/models/project_security_spec.rb @@ -12,7 +12,7 @@ describe Project do describe "read access" do before do - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::REPORTER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::REPORTER) end it { @abilities.allowed?(@u1, :read_project, @p1).should be_false } @@ -21,7 +21,7 @@ describe Project do describe "write access" do before do - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::DEVELOPER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::DEVELOPER) end it { @abilities.allowed?(@u1, :write_project, @p1).should be_false } @@ -30,8 +30,8 @@ describe Project do describe "admin access" do before do - @p1.users_projects.create(:project => @p1, :user => @u1, :project_access => UsersProject::DEVELOPER) - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::MASTER) + @p1.users_projects.create(project: @p1, user: @u1, project_access: UsersProject::DEVELOPER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::MASTER) end it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 2c8ddd5c..5bba4ff6 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -80,17 +80,17 @@ describe Project do end it "should return valid url to repo" do - project = Project.new(:path => "somewhere") + project = Project.new(path: "somewhere") project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git" end it "should return path to repo" do - project = Project.new(:path => "somewhere") + project = Project.new(path: "somewhere") project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") end it "returns the full web URL for this repo" do - project = Project.new(:code => "somewhere") + project = Project.new(code: "somewhere") project.web_url.should == "#{Gitlab.config.url}/somewhere" end @@ -101,7 +101,7 @@ describe Project do end it "should be invalid repo" do - project = Project.new(:name => "ok_name", :path => "/INVALID_PATH/", :code => "NEOK") + project = Project.new(name: "ok_name", path: "/INVALID_PATH/", code: "NEOK") project.valid_repo?.should be_false end end @@ -121,7 +121,7 @@ describe Project do let(:project) { Factory :project } it 'returns the creation date of the project\'s last event if present' do - last_event = double(:created_at => 'now') + last_event = double(created_at: 'now') project.stub(:events).and_return( [double, double, last_event] ) project.last_activity_date.should == last_event.created_at end @@ -161,7 +161,7 @@ describe Project do end it "should return nil" do - lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError) + lambda { Project.new(path: "invalid").repo }.should raise_error(Grit::NoSuchPathError) end it "should return nil" do @@ -214,10 +214,10 @@ describe Project do before do @merge_request = Factory :merge_request, - :project => project, - :merged => false, - :closed => false - @key = Factory :key, :user_id => project.owner.id + project: project, + merged: false, + closed: false + @key = Factory :key, user_id: project.owner.id end it "should close merge request if last commit from source branch was pushed to target branch" do diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 6724fb8d..1654e3b6 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -24,7 +24,7 @@ describe ProtectedBranch do end describe 'Callbacks' do - subject { ProtectedBranch.new(:project => project, :name => 'branch_name') } + subject { ProtectedBranch.new(project: project, name: 'branch_name') } it 'call update_repository after save' do subject.should_receive(:update_repository) @@ -38,7 +38,7 @@ describe ProtectedBranch do end describe '#commit' do - subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') } + subject { ProtectedBranch.new(project: project, name: 'cant_touch_this') } it 'commits itself to its project' do project.should_receive(:commit).with('cant_touch_this') diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb index 4ad4d168..56d76ed0 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/system_hook_spec.rb @@ -12,7 +12,7 @@ describe SystemHook do it "project_create hook" do user = Factory :user with_resque do - project = Factory :project_without_owner, :owner => user + project = Factory :project_without_owner, owner: user end WebMock.should have_requested(:post, @system_hook.url).with(body: /project_create/).once end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 89e0f96f..265dcef1 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -18,29 +18,29 @@ describe User do end it "should return valid identifier" do - user = User.new(:email => "test@mail.com") + user = User.new(email: "test@mail.com") user.identifier.should == "test_mail_com" end it "should return identifier without + sign" do - user = User.new(:email => "test+foo@mail.com") + user = User.new(email: "test+foo@mail.com") user.identifier.should == "test_foo_mail_com" end it "should execute callback when force_random_password specified" do - user = User.new(:email => "test@mail.com", :force_random_password => true) + user = User.new(email: "test@mail.com", force_random_password: true) user.should_receive(:generate_password) user.save end it "should not generate password by default" do - user = Factory(:user, :password => 'abcdefg', :password_confirmation => 'abcdefg') + user = Factory(:user, password: 'abcdefg', password_confirmation: 'abcdefg') user.password.should == 'abcdefg' end it "should generate password when forcing random password" do Devise.stub(:friendly_token).and_return('123456789') - user = User.create(:email => "test1@mail.com", :force_random_password => true) + user = User.create(email: "test1@mail.com", force_random_password: true) user.password.should == user.password_confirmation user.password.should == '12345678' end @@ -54,8 +54,8 @@ describe User do before do @user = Factory :user @note = Factory :note, - :author => @user, - :project => Factory(:project) + author: @user, + project: Factory(:project) end it "should destroy all notes with user" do diff --git a/spec/requests/admin/admin_hooks_spec.rb b/spec/requests/admin/admin_hooks_spec.rb index e8a345b6..2f026aab 100644 --- a/spec/requests/admin/admin_hooks_spec.rb +++ b/spec/requests/admin/admin_hooks_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe "Admin::Hooks" do before do @project = Factory :project, - :name => "LeGiT", - :code => "LGT" + name: "LeGiT", + code: "LGT" login_as :admin @system_hook = Factory :system_hook @@ -30,7 +30,7 @@ describe "Admin::Hooks" do before do @url = Faker::Internet.uri("http") visit admin_hooks_path - fill_in "hook_url", :with => @url + fill_in "hook_url", with: @url expect { click_button "Add System Hook" }.to change(SystemHook, :count).by(1) end diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb index 37cb7d67..0ce66f5f 100644 --- a/spec/requests/admin/admin_projects_spec.rb +++ b/spec/requests/admin/admin_projects_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe "Admin::Projects" do before do @project = Factory :project, - :name => "LeGiT", - :code => "LGT" + name: "LeGiT", + code: "LGT" login_as :admin end @@ -47,8 +47,8 @@ describe "Admin::Projects" do describe "Update project" do before do - fill_in "project_name", :with => "Big Bang" - fill_in "project_code", :with => "BB1" + fill_in "project_name", with: "Big Bang" + fill_in "project_code", with: "BB1" click_button "Save Project" @project.reload end @@ -85,9 +85,9 @@ describe "Admin::Projects" do describe "POST /admin/projects" do before do visit new_admin_project_path - fill_in 'project_name', :with => 'NewProject' - fill_in 'project_code', :with => 'NPR' - fill_in 'project_path', :with => 'gitlabhq_1' + fill_in 'project_name', with: 'NewProject' + fill_in 'project_code', with: 'NPR' + fill_in 'project_path', with: 'gitlabhq_1' expect { click_button "Create project" }.to change { Project.count }.by(1) @project = Project.last end @@ -109,7 +109,7 @@ describe "Admin::Projects" do end it "should create new user" do - select @new_user.name, :from => "user_ids" + select @new_user.name, from: "user_ids" expect { click_button "Add" }.to change { UsersProject.count }.by(1) page.should have_content @new_user.name current_path.should == admin_project_path(@project) diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb index ba6831e3..68358bf0 100644 --- a/spec/requests/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -22,10 +22,10 @@ describe "Admin::Users" do before do @password = "123ABC" visit new_admin_user_path - fill_in "user_name", :with => "Big Bang" - fill_in "user_email", :with => "bigbang@mail.com" - fill_in "user_password", :with => @password - fill_in "user_password_confirmation", :with => @password + fill_in "user_name", with: "Big Bang" + fill_in "user_email", with: "bigbang@mail.com" + fill_in "user_password", with: @password + fill_in "user_password_confirmation", with: @password end it "should create new user" do @@ -40,7 +40,7 @@ describe "Admin::Users" do end it "should call send mail" do - Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) + Notify.should_receive(:new_user_email).and_return(stub(deliver: true)) User.observers.enable :user_observer do click_button "Save" @@ -88,8 +88,8 @@ describe "Admin::Users" do describe "Update user" do before do - fill_in "user_name", :with => "Big Bang" - fill_in "user_email", :with => "bigbang@mail.com" + fill_in "user_name", with: "Big Bang" + fill_in "user_email", with: "bigbang@mail.com" check "user_admin" click_button "Save" end @@ -114,7 +114,7 @@ describe "Admin::Users" do end it "should create new user" do - select @new_project.name, :from => "project_ids" + select @new_project.name, from: "project_ids" expect { click_button "Add" }.to change { UsersProject.count }.by(1) page.should have_content @new_project.name current_path.should == admin_user_path(@user) diff --git a/spec/requests/atom/dashboard_issues_spec.rb b/spec/requests/atom/dashboard_issues_spec.rb index 7260dcf4..9b4ffc0e 100644 --- a/spec/requests/atom/dashboard_issues_spec.rb +++ b/spec/requests/atom/dashboard_issues_spec.rb @@ -7,40 +7,40 @@ describe "User Issues Dashboard" do login_as :user @project1 = Factory :project, - :path => "project1", - :code => "TEST1" + path: "project1", + code: "TEST1" @project2 = Factory :project, - :path => "project2", - :code => "TEST2" + path: "project2", + code: "TEST2" @project1.add_access(@user, :read, :write) @project2.add_access(@user, :read, :write) @issue1 = Factory :issue, - :author => @user, - :assignee => @user, - :project => @project1 + author: @user, + assignee: @user, + project: @project1 @issue2 = Factory :issue, - :author => @user, - :assignee => @user, - :project => @project2 + author: @user, + assignee: @user, + project: @project2 visit dashboard_issues_path end - describe "atom feed", :js => false do + describe "atom feed", js: false do it "should render atom feed via private token" do logout - visit dashboard_issues_path(:atom, :private_token => @user.private_token) + visit dashboard_issues_path(:atom, private_token: @user.private_token) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{@user.name} issues") - page.body.should have_selector("author email", :text => @issue1.author_email) - page.body.should have_selector("entry summary", :text => @issue1.title) - page.body.should have_selector("author email", :text => @issue2.author_email) - page.body.should have_selector("entry summary", :text => @issue2.title) + page.body.should have_selector("title", text: "#{@user.name} issues") + page.body.should have_selector("author email", text: @issue1.author_email) + page.body.should have_selector("entry summary", text: @issue1.title) + page.body.should have_selector("author email", text: @issue2.author_email) + page.body.should have_selector("entry summary", text: @issue2.title) end end end diff --git a/spec/requests/atom/dashboard_spec.rb b/spec/requests/atom/dashboard_spec.rb index 4db8ce49..00c7a525 100644 --- a/spec/requests/atom/dashboard_spec.rb +++ b/spec/requests/atom/dashboard_spec.rb @@ -5,7 +5,7 @@ describe "User Dashboard" do describe "GET /" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :read) visit dashboard_path end @@ -13,14 +13,14 @@ describe "User Dashboard" do it "should render projects atom feed via private token" do logout - visit dashboard_path(:atom, :private_token => @user.private_token) + visit dashboard_path(:atom, private_token: @user.private_token) page.body.should have_selector("feed title") end it "should not render projects page via private token" do logout - visit dashboard_path(:private_token => @user.private_token) + visit dashboard_path(private_token: @user.private_token) current_path.should == new_user_session_path end end diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb index 8d0b6c4f..468d1b22 100644 --- a/spec/requests/atom/issues_spec.rb +++ b/spec/requests/atom/issues_spec.rb @@ -11,9 +11,9 @@ describe "Issues" do describe "GET /issues" do before do @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project visit project_issues_path(project) end @@ -22,19 +22,19 @@ describe "Issues" do visit project_issues_path(project, :atom) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) + page.body.should have_selector("title", text: "#{project.name} issues") + page.body.should have_selector("author email", text: @issue.author_email) + page.body.should have_selector("entry summary", text: @issue.title) end it "should render atom feed via private token" do logout - visit project_issues_path(project, :atom, :private_token => @user.private_token) + visit project_issues_path(project, :atom, private_token: @user.private_token) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) + page.body.should have_selector("title", text: "#{project.name} issues") + page.body.should have_selector("author email", text: @issue.author_email) + page.body.should have_selector("entry summary", text: @issue.title) end end end diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb index 06ae6841..1076e90c 100644 --- a/spec/requests/gitlab_flavored_markdown_spec.rb +++ b/spec/requests/gitlab_flavored_markdown_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe "Gitlab Flavored Markdown" do let(:project) { Factory :project } - let(:issue) { Factory :issue, :project => project } - let(:merge_request) { Factory :merge_request, :project => project } + let(:issue) { Factory :issue, project: project } + let(:merge_request) { Factory :merge_request, project: project } let(:fred) do - u = Factory :user, :name => "fred" + u = Factory :user, name: "fred" project.users << u u end @@ -19,7 +19,7 @@ describe "Gitlab Flavored Markdown" do @test_file = "gfm_test_file" i.add(@test_file, "foo\nbar\n") # add commit with gfm - i.commit("fix ##{issue.id}\n\nask @#{fred.name} for details", :head => @branch_name) + i.commit("fix ##{issue.id}\n\nask @#{fred.name} for details", head: @branch_name) # add test tag @tag_name = "gfm-test-tag" @@ -27,8 +27,8 @@ describe "Gitlab Flavored Markdown" do end after do # delete test branch and tag - project.repo.git.native(:branch, {:D => true}, @branch_name) - project.repo.git.native(:tag, {:d => true}, @tag_name) + project.repo.git.native(:branch, {D: true}, @branch_name) + project.repo.git.native(:tag, {d: true}, @tag_name) project.repo.gc_auto end @@ -42,25 +42,25 @@ describe "Gitlab Flavored Markdown" do describe "for commits" do it "should render title in commits#index" do - visit project_commits_path(project, :ref => @branch_name) + visit project_commits_path(project, ref: @branch_name) page.should have_link("##{issue.id}") end it "should render title in commits#show" do - visit project_commit_path(project, :id => commit.id) + visit project_commit_path(project, id: commit.id) page.should have_link("##{issue.id}") end it "should render description in commits#show" do - visit project_commit_path(project, :id => commit.id) + visit project_commit_path(project, id: commit.id) page.should have_link("@#{fred.name}") end - it "should render title in refs#tree", :js => true do - visit tree_project_ref_path(project, :id => @branch_name) + it "should render title in refs#tree", js: true do + visit tree_project_ref_path(project, id: @branch_name) within(".tree_commit") do page.should have_link("##{issue.id}") @@ -68,7 +68,7 @@ describe "Gitlab Flavored Markdown" do end it "should render title in refs#blame" do - visit blame_file_project_ref_path(project, :id => @branch_name, :path => @test_file) + visit blame_file_project_ref_path(project, id: @branch_name, path: @test_file) within(".blame_commit") do page.should have_link("##{issue.id}") @@ -92,15 +92,15 @@ describe "Gitlab Flavored Markdown" do describe "for issues" do before do @other_issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :title => "fix ##{@other_issue.id}", - :description => "ask @#{fred.name} for details" + author: @user, + assignee: @user, + project: project, + title: "fix ##{@other_issue.id}", + description: "ask @#{fred.name} for details" end it "should render subject in issues#index" do @@ -126,8 +126,8 @@ describe "Gitlab Flavored Markdown" do describe "for merge requests" do before do @merge_request = Factory :merge_request, - :project => project, - :title => "fix ##{issue.id}" + project: project, + title: "fix ##{issue.id}" end it "should render title in merge_requests#index" do @@ -147,9 +147,9 @@ describe "Gitlab Flavored Markdown" do describe "for milestones" do before do @milestone = Factory :milestone, - :project => project, - :title => "fix ##{issue.id}", - :description => "ask @#{fred.name} for details" + project: project, + title: "fix ##{issue.id}", + description: "ask @#{fred.name} for details" end it "should render title in milestones#index" do @@ -173,45 +173,45 @@ describe "Gitlab Flavored Markdown" do describe "for notes" do - it "should render in commits#show", :js => true do - visit project_commit_path(project, :id => commit.id) - fill_in "note_note", :with => "see ##{issue.id}" + it "should render in commits#show", js: true do + visit project_commit_path(project, id: commit.id) + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in issue#show", :js => true do + it "should render in issue#show", js: true do visit project_issue_path(project, issue) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in merge_request#show", :js => true do + it "should render in merge_request#show", js: true do visit project_merge_request_path(project, merge_request) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in projects#wall", :js => true do + it "should render in projects#wall", js: true do visit wall_project_path(project) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in wikis#index", :js => true do + it "should render in wikis#index", js: true do visit project_wiki_path(project, :index) - fill_in "Title", :with => 'Test title' - fill_in "Content", :with => '[link test](test)' + fill_in "Title", with: 'Test title' + fill_in "Content", with: '[link test](test)' click_on "Save" - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") @@ -222,8 +222,8 @@ describe "Gitlab Flavored Markdown" do describe "for wikis" do before do visit project_wiki_path(project, :index) - fill_in "Title", :with => "Circumvent ##{issue.id}" - fill_in "Content", :with => "# Other pages\n\n* [Foo](foo)\n* [Bar](bar)\n\nAlso look at ##{issue.id} :-)" + fill_in "Title", with: "Circumvent ##{issue.id}" + fill_in "Content", with: "# Other pages\n\n* [Foo](foo)\n* [Bar](bar)\n\nAlso look at ##{issue.id} :-)" click_on "Save" end diff --git a/spec/requests/hooks_spec.rb b/spec/requests/hooks_spec.rb index 05432f13..7cfe7cfe 100644 --- a/spec/requests/hooks_spec.rb +++ b/spec/requests/hooks_spec.rb @@ -9,7 +9,7 @@ describe "Hooks" do describe "GET index" do it "should be available" do - @hook = Factory :project_hook, :project => @project + @hook = Factory :project_hook, project: @project visit project_hooks_path(@project) page.should have_content "Hooks" page.should have_content @hook.url @@ -20,7 +20,7 @@ describe "Hooks" do before do @url = Faker::Internet.uri("http") visit project_hooks_path(@project) - fill_in "hook_url", :with => @url + fill_in "hook_url", with: @url expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1) end @@ -32,7 +32,7 @@ describe "Hooks" do describe "Test" do before do - @hook = Factory :project_hook, :project => @project + @hook = Factory :project_hook, project: @project stub_request(:post, @hook.url) visit project_hooks_path(@project) click_link "Test Hook" diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index ad7b0432..24c21db8 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -11,12 +11,12 @@ describe "Issues" do project.add_access(@user2, :read, :write) end - describe "Edit issue", :js => true do + describe "Edit issue", js: true do before do @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project visit project_issues_path(project) click_link "Edit" end @@ -27,8 +27,8 @@ describe "Issues" do describe "fill in" do before do - fill_in "issue_title", :with => "bug 345" - fill_in "issue_description", :with => "bug description" + fill_in "issue_title", with: "bug 345" + fill_in "issue_description", with: "bug description" end it { expect { click_button "Save changes" }.to_not change {Issue.count} } @@ -43,14 +43,14 @@ describe "Issues" do end end - describe "Search issue", :js => true do + describe "Search issue", js: true do before do ['foobar', 'foobar2', 'gitlab'].each do |title| @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :title => title + author: @user, + assignee: @user, + project: project, + title: title @issue.save end end @@ -62,7 +62,7 @@ describe "Issues" do visit project_issues_path(project) click_link 'Closed' - fill_in 'issue_search', :with => 'foobar' + fill_in 'issue_search', with: 'foobar' page.should have_content 'foobar' page.should_not have_content 'foobar2' @@ -71,7 +71,7 @@ describe "Issues" do it "should search for term and return the correct results" do visit project_issues_path(project) - fill_in 'issue_search', :with => 'foobar' + fill_in 'issue_search', with: 'foobar' page.should have_content 'foobar' page.should have_content 'foobar2' @@ -80,8 +80,8 @@ describe "Issues" do it "should return all results if term has been cleared" do visit project_issues_path(project) - fill_in "issue_search", :with => "foobar" - # Because fill_in, :with => "" triggers nothing we need to trigger a keyup event + fill_in "issue_search", with: "foobar" + # Because fill_in, with: "" triggers nothing we need to trigger a keyup event page.execute_script("$('.issue_search').val('').keyup();"); page.should have_content 'foobar' diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb index 580e5522..0fea7b46 100644 --- a/spec/requests/projects_deploy_keys_spec.rb +++ b/spec/requests/projects_deploy_keys_spec.rb @@ -10,7 +10,7 @@ describe "Projects", "DeployKeys" do describe "GET /keys" do before do - @key = Factory :key, :project => project + @key = Factory :key, project: project visit project_deploy_keys_path(project) end @@ -41,8 +41,8 @@ describe "Projects", "DeployKeys" do describe "fill in" do before do - fill_in "key_title", :with => "laptop" - fill_in "key_key", :with => "publickey234=" + fill_in "key_title", with: "laptop" + fill_in "key_key", with: "publickey234=" end it { expect { click_button "Save" }.to change {Key.count}.by(1) } @@ -57,7 +57,7 @@ describe "Projects", "DeployKeys" do describe "Show page" do before do - @key = Factory :key, :project => project + @key = Factory :key, project: project visit project_deploy_key_path(project, @key) end diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index f96affc7..63f8a696 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -5,7 +5,7 @@ describe "Projects" do describe "GET /projects/show" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :read) visit project_path(@project) @@ -37,13 +37,13 @@ describe "Projects" do describe "PUT /projects/:id" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :admin, :read) visit edit_project_path(@project) - fill_in 'project_name', :with => 'Awesome' - fill_in 'project_code', :with => 'gitlabhq' + fill_in 'project_name', with: 'Awesome' + fill_in 'project_code', with: 'gitlabhq' click_button "Save" @project = @project.reload end diff --git a/spec/requests/search_spec.rb b/spec/requests/search_spec.rb index 377bc215..537c4d0c 100644 --- a/spec/requests/search_spec.rb +++ b/spec/requests/search_spec.rb @@ -6,7 +6,7 @@ describe "Search" do @project = Factory :project @project.add_access(@user, :read) visit search_path - fill_in "search", :with => @project.name[0..3] + fill_in "search", with: @project.name[0..3] click_button "Search" end diff --git a/spec/requests/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb index bcca42f5..d503cf85 100644 --- a/spec/requests/security/project_access_spec.rb +++ b/spec/requests/security/project_access_spec.rb @@ -20,9 +20,9 @@ describe "Application access" do @u2 = Factory :user @u3 = Factory :user # full access - @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER) + @project.users_projects.create(user: @u1, project_access: UsersProject::MASTER) # readonly - @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER) + @project.users_projects.create(user: @u3, project_access: UsersProject::REPORTER) end describe "GET /project_code" do @@ -83,7 +83,7 @@ describe "Application access" do before do @commit = @project.commit @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name - @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path) + @blob_path = blob_project_ref_path(@project, @commit.id, path: @path) end it { @blob_path.should be_allowed_for @u1 } diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index 9b9bb0e9..6b993660 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -11,8 +11,8 @@ describe "Snippets" do describe "GET /snippets" do before do @snippet = Factory :snippet, - :author => @user, - :project => project + author: @user, + project: project visit project_snippets_path(project) end @@ -50,9 +50,9 @@ describe "Snippets" do describe "fill in" do before do - fill_in "snippet_title", :with => "login function" - fill_in "snippet_file_name", :with => "test.rb" - fill_in "snippet_content", :with => "def login; end" + fill_in "snippet_title", with: "login function" + fill_in "snippet_file_name", with: "test.rb" + fill_in "snippet_content", with: "def login; end" end it { expect { click_button "Save" }.to change {Snippet.count}.by(1) } @@ -69,8 +69,8 @@ describe "Snippets" do describe "Edit snippet" do before do @snippet = Factory :snippet, - :author => @user, - :project => project + author: @user, + project: project visit project_snippet_path(project, @snippet) click_link "Edit" end @@ -81,9 +81,9 @@ describe "Snippets" do describe "fill in" do before do - fill_in "snippet_title", :with => "login function" - fill_in "snippet_file_name", :with => "test.rb" - fill_in "snippet_content", :with => "def login; end" + fill_in "snippet_title", with: "login function" + fill_in "snippet_file_name", with: "test.rb" + fill_in "snippet_content", with: "def login; end" end it { expect { click_button "Save" }.to_not change {Snippet.count} } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65e7e529..31ca2a2b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -37,7 +37,7 @@ RSpec.configure do |config| # instead of true. config.use_transactional_fixtures = false - config.before :each, :type => :integration do + config.before :each, type: :integration do DeviseSessionMock.disable end @@ -59,7 +59,7 @@ RSpec.configure do |config| DatabaseCleaner.clean end - config.include RSpec::Rails::RequestExampleGroup, :type => :request, :example_group => { - :file_path => /spec\/api/ + config.include RSpec::Rails::RequestExampleGroup, type: :request, example_group: { + file_path: /spec\/api/ } end diff --git a/spec/support/login.rb b/spec/support/login.rb index 026e336d..78a907ba 100644 --- a/spec/support/login.rb +++ b/spec/support/login.rb @@ -1,10 +1,10 @@ module LoginMacros def login_as role - @user = User.create(:email => "user#{User.count}@mail.com", - :name => "John Smith", - :password => "123456", - :password_confirmation => "123456", - :skype => 'user_skype') + @user = User.create(email: "user#{User.count}@mail.com", + name: "John Smith", + password: "123456", + password_confirmation: "123456", + skype: 'user_skype') if role == :admin @user.admin = true @@ -12,15 +12,15 @@ module LoginMacros end visit new_user_session_path - fill_in "user_email", :with => @user.email - fill_in "user_password", :with => "123456" + fill_in "user_email", with: @user.email + fill_in "user_password", with: "123456" click_button "Sign in" end def login_with(user) visit new_user_session_path - fill_in "user_email", :with => user.email - fill_in "user_password", :with => "123456" + fill_in "user_email", with: user.email + fill_in "user_password", with: "123456" click_button "Sign in" end diff --git a/spec/support/valid_commit.rb b/spec/support/valid_commit.rb index 8094b679..0af36e34 100644 --- a/spec/support/valid_commit.rb +++ b/spec/support/valid_commit.rb @@ -9,7 +9,7 @@ module ValidCommit C_FILE_PATH = "app/models" C_FILES = [".gitkeep", "ability.rb", "commit.rb", "issue.rb", "key.rb", "mailer_observer.rb", "merge_request.rb", "note.rb", "project.rb", "protected_branch.rb", "repository.rb", "snippet.rb", "tree.rb", "user.rb", "users_project.rb", "web_hook.rb", "wiki.rb"] - BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n} + BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: \"btn danger delete-key\"\n\n\n} BLOB_FILE_PATH = "app/views/keys/show.html.haml" end diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 5f3b6d3d..6f4bcca2 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -10,7 +10,7 @@ describe PostReceive do context "web hook" do let(:project) { Factory.create(:project) } - let(:key) { Factory.create(:key, :user => project.owner) } + let(:key) { Factory.create(:key, user: project.owner) } let(:key_id) { key.identifier } it "fetches the correct project" do