diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-02-08 01:00:49 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-02-08 01:00:49 +0200 |
commit | 4d89322d6785580e9a77e2536b8f2a7db8482664 (patch) | |
tree | 79e80598cecf1410440410590657a3388307ace6 /app | |
parent | 3d77183c160c57f51f1908bd57312344e34c8524 (diff) | |
download | gitlab-ce-4d89322d6785580e9a77e2536b8f2a7db8482664.tar.gz |
Snippets - fixed after bootstrap
Project - restyled show page, removed info page
Repository - restyled show page, added download option
Tags - added download options
Diffstat (limited to 'app')
34 files changed, 295 insertions, 330 deletions
diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js new file mode 100644 index 00000000000..f34f198d850 --- /dev/null +++ b/app/assets/javascripts/pager.js @@ -0,0 +1,44 @@ +var Pager = { + ref:null, + limit:0, + offset:0, + + init: + function(ref, limit) { + this.ref=ref; + this.limit=limit; + this.offset=limit; + this.initLoadMore(); + $('.loading').show(); + }, + + getOld: + function() { + $('.loading').show(); + $.ajax({ + type: "GET", + url: location.href, + data: "limit=" + this.limit + "&offset=" + this.offset, + complete: function(){ $('.loading').hide()}, + dataType: "script"}); + }, + + append: + function(count, html) { + $(".content_list").append(html); + if(count > 0) { + this.offset += count; + this.initLoadMore(); + } + }, + + initLoadMore: + function() { + $(window).bind('scroll', function(){ + if($(window).scrollTop() == $(document).height() - $(window).height()){ + $(window).unbind('scroll'); + Pager.getOld(); + } + }); + } +} diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 61780e6869a..330c25773e3 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -97,7 +97,7 @@ $blue_link: "#2fa0bb"; min-width:$min_app_width; max-width:$max_app_width; margin:auto; - margin-top:51px; + margin-top:52px; } .container-fluid > .sidebar { @@ -113,7 +113,7 @@ $blue_link: "#2fa0bb"; aside a { display:block; position:relative; - padding:15px 10px; + padding:12px 10px; margin:10px 0 0 0; font-size:13px; font-weight:bold; @@ -169,6 +169,7 @@ img.lil_av { p { padding-top:5px;} } +.visible_link, .author_link { color: $active_link_color; } diff --git a/app/assets/stylesheets/highlight.css.scss b/app/assets/stylesheets/highlight.css.scss index 637400b9c34..f82a9e55a56 100644 --- a/app/assets/stylesheets/highlight.css.scss +++ b/app/assets/stylesheets/highlight.css.scss @@ -17,6 +17,7 @@ td.code, td.linenos{ padding:0; margin:0; + border-top:0; vertical-align:top; } diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index ddc21bb9512..df5d40b3128 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -191,3 +191,13 @@ a.project-update.titled { } } + +input.git_clone_url { + width:475px; +} + +.team_member_row { + img { + width:60px; + } +} diff --git a/app/assets/stylesheets/top_panel.scss b/app/assets/stylesheets/top_panel.scss index 61db2c311cf..da7b5b37027 100644 --- a/app/assets/stylesheets/top_panel.scss +++ b/app/assets/stylesheets/top_panel.scss @@ -3,7 +3,7 @@ body header { width:100%; padding:0; margin:0; - top:0; + top:1px; left:0; background: #F1F1F1; /* for non-css3 browsers */ border-bottom: 1px solid #ccc; @@ -23,12 +23,13 @@ body header { .project_name { float:left; - width:235px; + width:400px; margin-right:30px; font-size:16px; font-weight:bold; padding:8px; color:#333; + text-shadow: 0 1px 1px #FFF; } .git_url_wrapper { diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c9ffa5b72af..955d863c992 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -57,7 +57,7 @@ class ProjectsController < ApplicationController def update respond_to do |format| if project.update_attributes(params[:project]) - format.html { redirect_to info_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" } @@ -69,17 +69,13 @@ class ProjectsController < ApplicationController def show return render "projects/empty" unless @project.repo_exists? && @project.has_commits? limit = (params[:limit] || 10).to_i - - @activities = @project.activities(limit)#updates_wo_repo(limit) + @activities = @project.activities(limit) end def files @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) end - def info - end - # # Wall # diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 1e715931320..5ede9b5f598 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -19,4 +19,28 @@ class RepositoriesController < ApplicationController def tags @tags = @project.repo.tags.sort_by(&:name).reverse end + + def archive + unless can?(current_user, :download_code, @project) + render_404 and return + end + + ref = params[:ref] || @project.root_ref + commit = @project.commit(ref) + render_404 and return unless commit + + # Build file path + file_name = @project.code + "-" + commit.id.to_s + ".tar.gz" + storage_path = File.join(Rails.root, "tmp", "repositories", @project.code) + file_path = File.join(storage_path, file_name) + + # Create file if not exists + unless File.exists?(file_path) + FileUtils.mkdir_p storage_path + file = @project.repo.archive_to_file(ref, nil, file_path) + end + + # Send file to user + send_file file_path + end end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 45b3f529c4c..efab4c4467d 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -59,6 +59,7 @@ class SnippetsController < ApplicationController @snippet = @project.snippets.find(params[:id]) @notes = @snippet.notes @note = @project.notes.new(:noteable => @snippet) + render_full_content end def destroy diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 817ab475490..0c0ce0fb165 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -17,7 +17,7 @@ module ProjectsHelper end def project_tab_class - [:show, :files, :team, :edit, :update, :info].each do |action| + [:show, :files, :team, :edit, :update].each do |action| return "current" if current_page?(:controller => "projects", :action => action, :id => @project) end diff --git a/app/models/ability.rb b/app/models/ability.rb index a02f44a4cb8..f31b510d8bd 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -40,6 +40,10 @@ class Ability :admin_note ] if project.allow_admin_for?(user) + rules << [ + :download_code, + ] if project.allow_pull_for?(user) + rules.flatten end diff --git a/app/models/project.rb b/app/models/project.rb index e1c66c95a23..d98b7d0ca1f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -233,6 +233,10 @@ class Project < ActiveRecord::Base !users_projects.where(:user_id => user.id, :project_access => [PROJECT_RWA]).empty? || owner_id == user.id end + def allow_pull_for?(user) + !users_projects.where(:user_id => user.id, :repo_access => [Repository::REPO_R, Repository::REPO_RW]).empty? + end + def root_ref default_branch || "master" end diff --git a/app/views/commits/_commit.html.haml b/app/views/commits/_commit.html.haml index c2a8c975952..fb59abb39a8 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/commits/_commit.html.haml @@ -1,8 +1,7 @@ %li.entry = link_to project_commit_path(@project, :id => commit.id) do %div - %strong - = truncate commit.id.to_s, :length => 10 + %code= commit.id.to_s[0..10] – = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 = truncate(commit.safe_message, :length => 50) diff --git a/app/views/commits/_index.html.haml b/app/views/commits/_index.html.haml deleted file mode 100644 index f1e4c7eb3f1..00000000000 --- a/app/views/commits/_index.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -= form_tag project_commits_path(@project), :method => :get do - %h3 - = @project.name - [ #{select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "small"} ] -= link_to 'Back', project_path(@project), :class => "button" -%h1 Listing commits -%div{:id => dom_id(@project)} - = render "commits" -%br/ diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 28be79bcaf0..4d142537879 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -1,17 +1,11 @@ .commit - %span.commit-info - = link_to tree_project_ref_path(@project, @commit.id), :class => "btn right" do - Browse Code » - - if @commit.author_email - = image_tag gravatar_icon(@commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" - - else - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" - %span.commit-title - %strong - = truncate(@commit.id.to_s, :length => 60) - %span.commit-author - %strong= @commit.author_name - = @commit.created_at.stamp("Aug 21, 2011 9:23pm") + = link_to tree_project_ref_path(@project, @commit.id), :class => "btn right small" do + Browse Code » + = image_tag gravatar_icon(@commit.author_email), :class => "avatar" + %code= @commit.id.to_s + %h5 + = @commit.author_name + %small= @commit.created_at.stamp("Aug 21, 2011 9:23pm") %hr %pre.commit_message diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 7d8ceecf5b6..190c443a2e7 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -8,9 +8,7 @@ - if project_layout .project_name - = truncate @project.name, :length => 28 - .git_url_wrapper - %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"} + = truncate @project.name, :length => 35 .account-box diff --git a/app/views/layouts/_project_side.html.haml b/app/views/layouts/_project_side.html.haml index cc3174fe604..c5206a9ec7a 100644 --- a/app/views/layouts/_project_side.html.haml +++ b/app/views/layouts/_project_side.html.haml @@ -6,8 +6,12 @@ - if @project.repo_exists? = link_to "Repository", project_repository_path(@project), :class => repository_tab_class - = link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class - = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil + %ul + %li + = link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class + %li + = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil + = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil - if @project.issues_enabled = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do diff --git a/app/views/projects/_feed.html.haml b/app/views/projects/_feed.html.haml index e399f5cab9a..e973a763d9b 100644 --- a/app/views/projects/_feed.html.haml +++ b/app/views/projects/_feed.html.haml @@ -1,29 +1,23 @@ -%li.wll - .row - .span9 - = image_tag gravatar_icon(update.author_email), :class => "avatar thumb" - %p - %strong.author= update.author_name - %span +- @activities.each do |update| + .entry + = link_to dashboard_feed_path(@project, update) do + - if update.kind_of? Note + %p + %strong + - if update.target + = update.target.class.name.titleize + = truncate update.target.id.to_s, :length => 10 + commented + - else + Project wall – - authored - = time_ago_in_words(update.created_at) - ago - - if update.kind_of? MergeRequest - = link_to project_merge_request_path(@project, update) do - = "Opened merge request ##{update.id}." - %span.label= update.source_branch - → - %span.label= update.target_branch - - elsif update.kind_of? Issue - = link_to project_issue_path(@project, update) do - Opened new - %span.label.important= "issue ##{update.id}" - = truncate update.title + = image_tag gravatar_icon(update.author_email), :class => "", :width => 16 + = truncate dashboard_feed_title(update), :length => 50 - else - = link_to [@project, update.target] do - %p - = update.target.class.name.titleize - = truncate(update.target.id.to_s, :length => 10) - - = dashboard_feed_title(update) + %p + %strong + = update.class.name.titleize + = truncate update.id.to_s + – + = image_tag gravatar_icon(update.author_email), :class => "", :width => 16 + = truncate dashboard_feed_title(update), :length => 50 diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 37446585d9b..01c1cac1793 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -10,13 +10,17 @@ .clearfix = f.label :path do Path - %cite= "git@#{GIT_HOST["host"]}:" - .input= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? + .input + .input-prepend + %span.add-on= "git@#{GIT_HOST["host"]}:" + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? .clearfix = f.label :code do Code - %cite= "http://#{GIT_HOST["host"]}/" - .input= f.text_field :code, :placeholder => "example" + .input + .input-prepend + %span.add-on= "http://#{GIT_HOST["host"]}/" + = f.text_field :code, :placeholder => "example" - unless @project.new_record? || @project.heads.empty? .clearfix diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml index 0d56b43970e..8207d89d4b5 100644 --- a/app/views/projects/_project_head.html.haml +++ b/app/views/projects/_project_head.html.haml @@ -1,30 +1,18 @@ %ul.tabs %li{ :class => "#{'active' if current_page?(project_path(@project)) }" } = link_to project_path(@project), :class => "activities-tab tab" do - Activities - %li{ :class => "#{'active' if current_page?(info_project_path(@project)) || current_page?(edit_project_path(@project)) }" } - = link_to info_project_path(@project), :class => "stat-tab tab " do - Info + Show + - if can? current_user, :admin_project, @project + %li{ :class => "#{'active' if current_page?(edit_project_path(@project)) }" } + = link_to edit_project_path(@project), :class => "stat-tab tab " do + Edit - %li{ :class => " #{'active' if current_page?(team_project_path(@project)) }" } + %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 Team %li{ :class => "#{'active' if current_page?(files_project_path(@project)) }" } = link_to files_project_path(@project), :class => "files-tab tab " do Files - %li{ :class => " #{'active' if current_page?(project_snippets_path(@project)) }" } + %li{ :class => " #{'active' if (controller.controller_name == "snippets") }" } = link_to project_snippets_path(@project), :class => "snippets-tab tab" do Snippets - - - if current_page?(project_snippets_path(@project)) - - if can? current_user, :write_snippet, @project - %li - = link_to new_project_snippet_path(@project), :class => "add_new", :title => "New Snippet" do - Add new - - - - if current_page?(team_project_path(@project)) - - if can? current_user, :admin_team_member, @project - %li - = link_to new_project_team_member_path(@project), :class => "add_new", :title => "New Team Member" do - Add New diff --git a/app/views/projects/info.html.haml b/app/views/projects/info.html.haml deleted file mode 100644 index d1196873619..00000000000 --- a/app/views/projects/info.html.haml +++ /dev/null @@ -1,96 +0,0 @@ -= render "project_head" - -.entry - %h3= @project.name - %br - - - - %pre - = "git clone #{@project.url_to_repo}" - - - -%h4 Details: - -%table - %tr - %td Name - %td= @project.name - - %tr - %td Slug - %td= @project.code - - %tr - %td Path - %td= @project.path - - %tr - %td Owner - %td= link_to @project.owner.name, project_team_member_path(@project, @project.team_member_by_id(@project.owner)) - - %tr - %td Last commit - %td - = time_ago_in_words(@project.commit.committed_date) - ago - - %tr - %td Team - %td - = @project.users_projects.count - users - - %tr - %td Open Issues - %td - = @project.issues.opened.count - - %tr - %td Merge Requests - %td - = @project.merge_requests.opened.count - - %tr - %td Created - %td= @project.created_at.stamp("Aug 21, 2011") - - %tr - %td{:colspan => 2}= simple_format @project.description - - -%h4 Features: - -%table - %tr - %td Issues - %td - - if @project.issues_enabled - .alert-message.success - Enabled - - else - .alert-message.error - Disabled - - %tr - %td Merge Requests - %td - - if @project.merge_requests_enabled - .alert-message.success - Enabled - - else - .alert-message.error - Disabled - %tr - %td Wall - %td - - if @project.wall_enabled - .alert-message.success - Enabled - - else - .alert-message.error - Disabled -.actions - = link_to "Edit", edit_project_path(@project), :class => "btn" - diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 066aea4edae..7886daec1da 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,24 +1,16 @@ = render "project_head" -- @activities.each do |update| - .entry - = link_to dashboard_feed_path(@project, update) do - - if update.kind_of? Note - %p - %strong - - if update.target - = update.target.class.name.titleize - = truncate update.target.id.to_s, :length => 10 - commented - - else - Project wall - – - = image_tag gravatar_icon(update.author_email), :class => "", :width => 16 - = truncate dashboard_feed_title(update), :length => 50 - - else - %p - %strong - = update.class.name.titleize - = truncate update.id.to_s - – - = image_tag gravatar_icon(update.author_email), :class => "", :width => 16 - = truncate dashboard_feed_title(update), :length => 50 +%h3 + = @project.name +%hr +.alert-message.block-message.warning + .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" + += simple_format @project.description + +%h5.cgray Recent Activity +.content_list= render "feed" + + diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml index 295e212fbaa..884c1645445 100644 --- a/app/views/projects/team.html.haml +++ b/app/views/projects/team.html.haml @@ -1,3 +1,12 @@ = render "project_head" + +- if can? current_user, :admin_team_member, @project + .alert-message.block-message + = link_to new_project_team_member_path(@project), :class => "btn small right", :title => "New Team Member" do + New Team Member + Manage project team from this page. + %br + To open team member profile - click on avatar. + = render :partial => "team", :locals => {:project => @project} diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml index 4c69128b297..de12527e004 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 = "#{info_project_path(@project, :notice => 'Project was successfully updated.')}"; + location.href = "#{edit_project_path(@project, :notice => 'Project was successfully updated.')}"; - else :plain $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/repositories/_feed.html.haml b/app/views/repositories/_feed.html.haml index cecb21ec7a5..204157ceadc 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/repositories/_feed.html.haml @@ -4,10 +4,10 @@ %p %strong = commit.head.name - – - = truncate(commit.id.to_s, :length => 10) + %br + %code= commit.id.to_s[0..10] = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 = truncate(commit.safe_message, :length => 40) - %span.right + %span.right.cgray = time_ago_in_words(commit.committed_date) ago diff --git a/app/views/repositories/show.html.haml b/app/views/repositories/show.html.haml index 91dd8ee663d..c92ad48acb6 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/repositories/show.html.haml @@ -1,4 +1,31 @@ = render "head" +%h3 + = @project.name + - if can? current_user, :download_code, @project + = link_to "Download", archive_project_repository_path(@project), :class => "btn small right" + + +%hr +.alert-message.block-message.warning + .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" + + +%p + Last commit was + %small + %code= @activities.first.commit.id.to_s[0..10] + + = time_ago_in_words(@activities.first.commit.committed_date) + ago to + = link_to project_commits_path(@project, :ref => @activities.first.head.name), :class => "visible_link" do + = @activities.first.head.name + +%h4.cgray + Recent Branches + %ul.unstyled - @activities.each do |update| = render "repositories/feed", :update => update, :project => @project diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml index bff838fa7f0..b67010c7ba5 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/repositories/tags.html.haml @@ -1,13 +1,17 @@ = render "head" - unless @tags.empty? - %div.update-data.ui-box.ui-box-small - .data - - @tags.each do |tag| - %a.update-item{:href => project_commits_path(@project, :ref => tag.name)} - %span.update-title{:style => "margin-bottom:0px;"} - = tag.name - %span.update-author.right - = time_ago_in_words(tag.commit.committed_date) - ago + - @tags.each do |tag| + .row + .span7 + .entry + = tag.name + %code= tag.commit.id.to_s[0..10] + %span.update-author.right + = time_ago_in_words(tag.commit.committed_date) + ago + .span3 + - if can? current_user, :download_code, @project + = link_to "Download", archive_project_repository_path(@project, :ref => tag.name), :class => "btn small" + = link_to "Commits", project_commits_path(@project, :ref => tag.name), :class => "btn small" - else %h3 No tags diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index 63ba3512e64..a0a00556030 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -1,48 +1,31 @@ +%h3= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}" +%hr = form_for [@project, @snippet] do |f| - %div - %span.entity-info - - if @snippet.new_record? - = link_to project_snippets_path(@project) do - .entity-button - Snippets - %i - - else - = link_to project_snippet_path(@project, @snippet) do - .entity-button - Show Snippet - %i - %h2= @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}" - - %hr %table.no-borders -if @snippet.errors.any? - %tr - %td{:colspan => 2} - #error_explanation - - @snippet.errors.full_messages.each do |msg| - %span= msg - %br + .alert-message.block-message.error + %ul + - @snippet.errors.full_messages.each do |msg| + %li= msg - %tr - %td= f.label :title - %td= f.text_field :title, :placeholder => "Example Snippet" - %tr - %td= f.label :file_name - %td= f.text_field :file_name, :placeholder => "example.rb" - %tr - %td= f.label "Lifetime" - %td= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;" - %tr - %td{:colspan => 2} - = f.label :content, "Code" - %br - %br - = f.text_area :content + .clearfix + = f.label :title + .input= f.text_field :title, :placeholder => "Example Snippet" + .clearfix + = f.label :file_name + .input= f.text_field :file_name, :placeholder => "example.rb" + .clearfix + = f.label "Lifetime" + .input= f.select :expires_at, lifetime_select_options, {}, :style => "width:200px;" + .clearfix + = f.label :content, "Code" + = f.text_area :content, :class => "xxlarge" - .merge-tabs - = f.submit 'Save', :class => "positive-button" + .actions + = 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 => "red-button 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 f8a483085ea..08acc9b6f41 100644 --- a/app/views/snippets/_snippet.html.haml +++ b/app/views/snippets/_snippet.html.haml @@ -1,12 +1,7 @@ -%a.update-item{:href => project_snippet_path(snippet.project, snippet)} - = image_tag gravatar_icon(snippet.author_email), :class => "left", :width => 40 - %span.update-title - = truncate(snippet.title, :length => 60) - %span.update-author - %strong= snippet.author_name - authored - = time_ago_in_words(snippet.created_at) - ago - .right - %span.tag.commit= snippet.file_name - +%li.entry + %a{:href => project_snippet_path(snippet.project, snippet)} + %p + %strong + = truncate(snippet.title, :length => 60) + %span.right.cgray + = snippet.file_name diff --git a/app/views/snippets/edit.html.haml b/app/views/snippets/edit.html.haml index f81c0b8bc64..8afaf46e95d 100644 --- a/app/views/snippets/edit.html.haml +++ b/app/views/snippets/edit.html.haml @@ -1 +1,2 @@ += render "projects/project_head" = render "snippets/form" diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index 1021dd1f597..b5658828c91 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,12 +1,12 @@ = render "projects/project_head" +- 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 + Add new snippet + Share code pastes with others if it cant be in a git repository + %br + To add new snippet - click on button. + - unless @snippets.fresh.empty? - %div{ :class => "update-data ui-box ui-box-small ui-box-big" } - .data - = render @snippets.fresh -- else - .notice_holder - %li Snippets do not exist yet. - - if can? current_user, :write_snippet, @project - %li You can add a new one by clicking on "Add New" button - + %ul.unstyled= render @snippets.fresh diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml index f81c0b8bc64..8afaf46e95d 100644 --- a/app/views/snippets/new.html.haml +++ b/app/views/snippets/new.html.haml @@ -1 +1,2 @@ += render "projects/project_head" = render "snippets/form" diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 59f810a77a3..165dd6e9c55 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -1,20 +1,10 @@ -%div - %span.entity-info - - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to edit_project_snippet_path(@project, @snippet) do - .entity-button - Edit Snippet - %i - - if @snippet.author_email - = image_tag gravatar_icon(@snippet.author_email), :class => "left", :width => 40, :style => "padding-right:5px;" - - else - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" - %span.commit-title - %strong - = truncate(@snippet.title, :length => 60) - %span.commit-author - %strong= @snippet.author_name - = @snippet.created_at.stamp("Aug 21, 2011 9:23pm") += render "projects/project_head" + +%h3 + = @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" %hr diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index 2a299fd0ba3..ec31deb183a 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -1,33 +1,34 @@ +%h3= "New Team member" +%hr = form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member) do |f| - %div - %span.entity-info - - if request.xhr? - = link_to project_team_members_path(@project) do - .entity-button - Team List - %i - %h3= "New Team member" - - %hr -if @team_member.errors.any? - %ul.errors_holder - - @team_member.errors.full_messages.each do |msg| - %li= msg + .alert-message.block-message.error + %ul + - @team_member.errors.full_messages.each do |msg| + %li= msg + + .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" }) + + .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" + + .clearfix + = f.label :repo_access, "Repository Access" + .input= f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select" - .span-6.append-bottom - %b Name - .span-6 - = f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" }) - .span-6 - %b Project Access: - .span-6 - = 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" - .span-6 - %b Repository Access: - .span-6 - = f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select" - %br - .merge-tabs - = f.submit 'Save', :class => "grey-button" +:css + form select { + width:300px; + } +:javascript + $('select#team_member_user_id').chosen(); + $('select#team_member_repo_access').chosen(); + $('select#team_member_project_access').chosen(); diff --git a/app/views/team_members/_show.html.haml b/app/views/team_members/_show.html.haml index 65c8aa0630c..e5cd947ba2b 100644 --- a/app/views/team_members/_show.html.haml +++ b/app/views/team_members/_show.html.haml @@ -1,10 +1,10 @@ - user = member.user - allow_admin = can? current_user, :admin_project, @project -%li{:id => dom_id(member)} +%li{:id => dom_id(member), :class => "team_member_row"} = link_to project_team_member_path(@project, member), :title => user.name do - = image_tag gravatar_icon(user.email, 90), :class => "thumbnail" + = image_tag gravatar_icon(user.email, 60), :class => "thumbnail" .row - .span6 + .span8 %h4 = truncate(user.name, :lenght => 24) %small= truncate user.email, :lenght => 24 |