From a6dad85d2f94d4e7763eb6b0daefde5f039ece34 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 11 Jun 2012 08:52:44 +0300 Subject: [PATCH] Get rid of modularity gem, Styled 'nothing here' message --- Gemfile | 1 - Gemfile.lock | 2 -- app/assets/stylesheets/gitlab_bootstrap.scss | 7 ++++++- app/controllers/projects_controller.rb | 12 +----------- app/decorators/milestone_decorator.rb | 4 ---- app/models/project.rb | 19 +++++++++++++++++++ app/views/dashboard/issues.html.haml | 3 +-- app/views/dashboard/merge_requests.html.haml | 3 +-- app/views/help/web_hooks.html.haml | 2 +- app/views/keys/index.html.haml | 5 +++++ app/views/projects/index.html.haml | 14 +++++++------- 11 files changed, 41 insertions(+), 31 deletions(-) delete mode 100644 app/decorators/milestone_decorator.rb diff --git a/Gemfile b/Gemfile index 842cfdc1249..43b08930129 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,6 @@ gem "omniauth-ldap" gem 'bootstrap-sass', "2.0.3.1" gem "colored" gem 'yaml_db', :git => "https://github.com/gitlabhq/yaml_db.git" -gem 'modularity' gem 'resque_mailer' gem 'chosen-rails' diff --git a/Gemfile.lock b/Gemfile.lock index b0581398cf3..aca7ab5e022 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -187,7 +187,6 @@ GEM mime-types (1.18) modernizr (2.5.3) sprockets (~> 2.0) - modularity (0.6.1) multi_json (1.3.6) multi_xml (0.5.1) mysql2 (0.3.11) @@ -368,7 +367,6 @@ DEPENDENCIES letter_opener linguist (~> 1.0.0)! modernizr (= 2.5.3) - modularity mysql2 omniauth-ldap pry diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index a8a38290765..af319b51405 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -403,7 +403,7 @@ form { margin-bottom: 40px; @include round-borders-all(4px); @include shade; - border-color:#ddd; + border-color:#CCC; ul { margin:0; @@ -522,3 +522,8 @@ ul.breadcrumb { } } +.nothing_here_message { + text-align:center; + padding:20px; + color:#777; +} diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 35938167d4e..2da97098719 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -29,17 +29,7 @@ class ProjectsController < ApplicationController end def create - @project = Project.new(params[:project]) - @project.owner = current_user - - Project.transaction do - @project.save! - @project.users_projects.create!(:project_access => UsersProject::MASTER, :user => current_user) - - # when project saved no team member exist so - # project repository should be updated after first user add - @project.update_repository - end + @project = Project.create_by_user(params[:project], current_user) respond_to do |format| if @project.valid? diff --git a/app/decorators/milestone_decorator.rb b/app/decorators/milestone_decorator.rb deleted file mode 100644 index c881da0e9ad..00000000000 --- a/app/decorators/milestone_decorator.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MilestoneDecorator < ApplicationDecorator - decorates :milestone - -end diff --git a/app/models/project.rb b/app/models/project.rb index 12556d35202..2e4b12e9990 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -42,6 +42,25 @@ class Project < ActiveRecord::Base where("name like :query or code like :query or path like :query", :query => "%#{query}%") end + def self.create_by_user(params, user) + project = Project.new params + + Project.transaction do + project.owner = user + + project.save! + + # Add user as project master + 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 + project.update_repository + end + + project + end + # # Validations # diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 9516578d12d..b794e634bf8 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -15,5 +15,4 @@ %hr = paginate @issues, :theme => "gitlab" - else - %h4.padded - %center Nothing to show here + %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 a7c9ed201a1..a7a78f519be 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -15,5 +15,4 @@ = paginate @merge_requests, :theme => "gitlab" - else - %h4.padded - %center Nothing to show here + %h3.nothing_here_message Nothing to show here diff --git a/app/views/help/web_hooks.html.haml b/app/views/help/web_hooks.html.haml index 2db69bd76d9..0e63237b8cb 100644 --- a/app/views/help/web_hooks.html.haml +++ b/app/views/help/web_hooks.html.haml @@ -3,5 +3,5 @@ %p Application will send POST request with some data like example below: %h5 Hooks request example: -.borders= render "hooks/data_ex" += render "hooks/data_ex" diff --git a/app/views/keys/index.html.haml b/app/views/keys/index.html.haml index 565cc800a8f..56ca4e818ea 100644 --- a/app/views/keys/index.html.haml +++ b/app/views/keys/index.html.haml @@ -12,3 +12,8 @@ %th - @keys.each do |key| = render(:partial => 'show', :locals => {:key => key}) + - if @keys.blank? + %tr + %td{:colspan => 3} + %h3.nothing_here_message There are no SSH keys with access to your account. + diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 6b050e0c86d..4a47e126043 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -35,15 +35,15 @@ .bottom= paginate @projects, :theme => "gitlab" - else - %h3 Nothing here + %h3.nothing_here_message There are no projects you have access to. %br - - if current_user.can_create_project? - .alert-message.block-message.warning + %h4.nothing_here_message + - if current_user.can_create_project? You can create up to = current_user.projects_limit - projects. Click on link below to add a new one + projects. Click on button below to add a new one .link_holder - = link_to new_project_path, :class => "" 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 + - else + If you will be added to project - it will be displayed here