Snippets - fixed after bootstrap
Project - restyled show page, removed info page Repository - restyled show page, added download option Tags - added download options
This commit is contained in:
parent
3d77183c16
commit
4d89322d67
37 changed files with 298 additions and 333 deletions
44
app/assets/javascripts/pager.js
Normal file
44
app/assets/javascripts/pager.js
Normal file
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ td.code,
|
|||
td.linenos{
|
||||
padding:0;
|
||||
margin:0;
|
||||
border-top:0;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,3 +191,13 @@ a.project-update.titled {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
input.git_clone_url {
|
||||
width:475px;
|
||||
}
|
||||
|
||||
.team_member_row {
|
||||
img {
|
||||
width:60px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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/
|
|
@ -1,17 +1,11 @@
|
|||
.commit
|
||||
%span.commit-info
|
||||
= link_to tree_project_ref_path(@project, @commit.id), :class => "btn right" do
|
||||
= link_to tree_project_ref_path(@project, @commit.id), :class => "btn right small" 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")
|
||||
= 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,8 +6,12 @@
|
|||
|
||||
- if @project.repo_exists?
|
||||
= link_to "Repository", project_repository_path(@project), :class => repository_tab_class
|
||||
%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
|
||||
|
|
|
@ -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
|
||||
–
|
||||
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
|
||||
- else
|
||||
= link_to [@project, update.target] do
|
||||
- @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)
|
||||
|
||||
= dashboard_feed_title(update)
|
||||
= 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
|
@ -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'))}");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;"}
|
||||
.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
|
||||
|
|
|
@ -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
|
||||
.alert-message.block-message.error
|
||||
%ul
|
||||
- @snippet.errors.full_messages.each do |msg|
|
||||
%span= msg
|
||||
%br
|
||||
%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}
|
||||
.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"
|
||||
%br
|
||||
%br
|
||||
= f.text_area :content
|
||||
= 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}"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
%li.entry
|
||||
%a{:href => project_snippet_path(snippet.project, snippet)}
|
||||
%p
|
||||
%strong
|
||||
= 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
|
||||
|
||||
%span.right.cgray
|
||||
= snippet.file_name
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
= render "projects/project_head"
|
||||
= render "snippets/form"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
= render "projects/project_head"
|
||||
|
||||
- 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
|
||||
- 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?
|
||||
%ul.unstyled= render @snippets.fresh
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
= render "projects/project_head"
|
||||
= render "snippets/form"
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
%div
|
||||
%span.entity-info
|
||||
= 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_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")
|
||||
= link_to "Edit", edit_project_snippet_path(@project, @snippet), :class => "btn small right"
|
||||
|
||||
%hr
|
||||
|
||||
|
|
|
@ -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
|
||||
.alert-message.block-message.error
|
||||
%ul
|
||||
- @team_member.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.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"
|
||||
.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" })
|
||||
|
||||
.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"
|
||||
.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"
|
||||
|
||||
.actions
|
||||
= f.submit 'Save', :class => "btn primary"
|
||||
= link_to "Cancel", team_project_path(@project), :class => "btn"
|
||||
|
||||
:css
|
||||
form select {
|
||||
width:300px;
|
||||
}
|
||||
|
||||
:javascript
|
||||
$('select#team_member_user_id').chosen();
|
||||
$('select#team_member_repo_access').chosen();
|
||||
$('select#team_member_project_access').chosen();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,7 +46,6 @@ Gitlab::Application.routes.draw do
|
|||
get "team"
|
||||
get "wall"
|
||||
get "graph"
|
||||
get "info"
|
||||
get "files"
|
||||
end
|
||||
|
||||
|
@ -54,6 +53,7 @@ Gitlab::Application.routes.draw do
|
|||
member do
|
||||
get "branches"
|
||||
get "tags"
|
||||
get "archive"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ describe "Projects" do
|
|||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == info_project_path(@project)
|
||||
current_path.should == edit_project_path(@project)
|
||||
end
|
||||
|
||||
it "should show project" do
|
||||
|
|
|
@ -73,7 +73,7 @@ describe "Snippets" do
|
|||
:author => @user,
|
||||
:project => project
|
||||
visit project_snippet_path(project, @snippet)
|
||||
click_link "Edit Snippet"
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
it "should open edit page" do
|
||||
|
|
Loading…
Reference in a new issue