diff options
Diffstat (limited to 'app/views/projects')
-rw-r--r-- | app/views/projects/_form.html.haml | 50 | ||||
-rw-r--r-- | app/views/projects/_side_panel.html.haml | 14 | ||||
-rw-r--r-- | app/views/projects/_team.html.haml | 18 | ||||
-rw-r--r-- | app/views/projects/_top_menu.html.haml | 24 | ||||
-rw-r--r-- | app/views/projects/_tree.html.haml | 60 | ||||
-rw-r--r-- | app/views/projects/_tree_file.html.haml | 21 | ||||
-rw-r--r-- | app/views/projects/_tree_item.html.haml | 15 | ||||
-rw-r--r-- | app/views/projects/create.js.haml | 6 | ||||
-rw-r--r-- | app/views/projects/edit.html.erb | 1 | ||||
-rw-r--r-- | app/views/projects/empty.html.erb | 49 | ||||
-rw-r--r-- | app/views/projects/index.html.haml | 25 | ||||
-rw-r--r-- | app/views/projects/new.html.erb | 1 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/team.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/tree.html.erb | 5 | ||||
-rw-r--r-- | app/views/projects/tree.js.haml | 5 | ||||
-rw-r--r-- | app/views/projects/update.js.haml | 6 | ||||
-rw-r--r-- | app/views/projects/wall.html.haml | 1 |
18 files changed, 307 insertions, 0 deletions
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml new file mode 100644 index 00000000000..baa1f14fe06 --- /dev/null +++ b/app/views/projects/_form.html.haml @@ -0,0 +1,50 @@ += form_for(@project, :remote => true) do |f| + %div.form_content + - if @project.new_record? + %h1 New Project + - else + %h1 Edit Project + - if @project.errors.any? + #error_explanation + %h2 + = pluralize(@project.errors.count, "error") + prohibited this project from being saved: + %ul + - @project.errors.full_messages.each do |msg| + %li= msg + %table.round-borders + %tr + %td= f.label :name + %td= f.text_field :name, :placeholder => "Example Project" + %tr + %td + .left= f.label :path + %cite.right git@yourserver: + %td + = f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record? + %tr + %td + .left= f.label :code + %cite.right http://yourserver/ + %td= f.text_field :code, :placeholder => "example (3..12 symbols only)" + .field + = f.label :description + %br/ + = f.text_area :description, :style => "height:140px;width:932px;" + .clear + %hr.prepend-top + .actions + = f.submit :class => "lbutton vm" + + %div{ :class => "ajax_loader", :style => "display:none;height:200px;"} + %center + = image_tag "ajax-loader.gif", :class => "append-bottom" + - if @project.new_record? + %h3.prepend-top Creating project & repository. Please wait for few minutes + - else + %h3.prepend-top Updating project & repository. Please wait for few minutes +:javascript + $('.new_project, .edit_project').bind('ajax:before', function() { + $(this).find(".form_content").hide(); + $('.ajax_loader').show(); + }); diff --git a/app/views/projects/_side_panel.html.haml b/app/views/projects/_side_panel.html.haml new file mode 100644 index 00000000000..2f786b4d242 --- /dev/null +++ b/app/views/projects/_side_panel.html.haml @@ -0,0 +1,14 @@ +%h3.notice{:style => "width:235px;"} + = @project.name +%p + %b Path: + = @project.path +%p + %b Description: + = truncate @project.description +.left.append-bottom + = link_to "Tree", tree_project_path(@project), :class => "button" + = link_to "Commits", project_commits_path(@project), :class => "button" + = link_to 'Team', team_project_path(@project), :class => "button" + - if can? current_user, :admin_project, @project + = link_to 'Edit', edit_project_path(@project), :class => "button positive" diff --git a/app/views/projects/_team.html.haml b/app/views/projects/_team.html.haml new file mode 100644 index 00000000000..bb9063369c3 --- /dev/null +++ b/app/views/projects/_team.html.haml @@ -0,0 +1,18 @@ +- if can? current_user, :admin_team_member, @project + %div#new-member-holder + = link_to "Add new", new_project_team_member_path(@project), :remote => true, :class => "lbutton vm" +%table.round-borders#team-table + %tr + %th Name + %th Email + %th Web + %th Git + %th Admin + - if can? current_user, :admin_team_member, @project + %th Actions + - @project.users_projects.each do |up| + = render(:partial => 'team_members/show', :locals => {:member => up}) + +:javascript + $('.delete-team-member').live('ajax:success', function() { + $(this).closest('tr').fadeOut(); }); diff --git a/app/views/projects/_top_menu.html.haml b/app/views/projects/_top_menu.html.haml new file mode 100644 index 00000000000..b81ba6bb4d6 --- /dev/null +++ b/app/views/projects/_top_menu.html.haml @@ -0,0 +1,24 @@ +%div.top_project_menu + -#%span= link_to @project.code.capitalize, @project, :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil + - if @project.repo_exists? + %span= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) || current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil + %span= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil + %span + = link_to team_project_path(@project), :class => current_page?(:controller => "projects", :action => "team", :id => @project) ? "current" : nil do + Team + - if @project.users_projects.count > 0 + %span{ :class => "top_menu_count" }= @project.users_projects.count + %span + = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do + Issues + - if @project.issues.opened.count > 0 + %span{ :class => "top_menu_count" }= @project.issues.opened.count + %span + = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do + Wall + - if @project.common_notes.count > 0 + %span{ :class => "top_menu_count" }= @project.common_notes.count + + - if @commit + %span= link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil + diff --git a/app/views/projects/_tree.html.haml b/app/views/projects/_tree.html.haml new file mode 100644 index 00000000000..af3a209a8ab --- /dev/null +++ b/app/views/projects/_tree.html.haml @@ -0,0 +1,60 @@ +%h3 + .left + = form_tag tree_project_path(@project), :method => :get do + = select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches" + + .left.prepend-1 + = form_tag tree_project_path(@project), :method => :get do + = select_tag "tag", options_for_select(@project.tags, @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Tags" + = text_field_tag "ssh", @project.url_to_repo, :class => ["ssh_project_url","one_click_select"] + .clear + +%h3#tree-breadcrumbs + = link_to @project.name, tree_project_path(@project, :path => nil, :commit_id => @commit.try(:id)), :remote => true + - if params[:path] + - part_path = "" + - params[:path].split("\/").each do |part| + - part_path = File.join(part_path, part) unless part_path.empty? + - if part_path.empty? + - part_path = part + \/ + = link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id)), :remote => :true +#tree-content-holder + - if tree.is_a?(Grit::Blob) + = render :partial => "projects/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree } + - else + - contents = tree.contents + %table#tree-slider.round-borders + %tr + %th Name + %th Last Update + %th + Last commit + = link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right" + - if params[:path] + - file = File.join(params[:path], "..") + %tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) } + %td.tree-item-file-name + = image_tag "dir.png" + = link_to "..", tree_file_project_path(@project, @commit.id, file), :remote => :true + %td + %td + + - contents.select{ |i| i.is_a?(Grit::Tree)}.each do |content| + = render :partial => "projects/tree_item", :locals => { :content => content } + - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| + = render :partial => "projects/tree_item", :locals => { :content => content } + +:javascript + $(function(){ + $('select#branch').selectmenu({style:'popup', width:200}); + $('select#tag').selectmenu({style:'popup', width:200}); + }); + +- if params[:path] && request.xhr? + :javascript + $(window).unbind('popstate'); + $(window).bind('popstate', function() { + if(location.pathname.search("tree") != -1) { + $.ajax({type: "GET", url: location.pathname, dataType: "script"})} + else { location.href = location.pathname;}}); diff --git a/app/views/projects/_tree_file.html.haml b/app/views/projects/_tree_file.html.haml new file mode 100644 index 00000000000..08927fc2aac --- /dev/null +++ b/app/views/projects/_tree_file.html.haml @@ -0,0 +1,21 @@ +- require "utils" +.view_file + .view_file_header + %strong + = name + -#= file.mime_type + = link_to "raw", blob_project_path(@project, :commit_id => @commit.id, :path => params[:path] ), :class => "right", :target => "_blank" + = link_to "history", project_commits_path(@project, :path => params[:path]), :class => "right", :style => "margin-right:10px;" + %br/ + - if file.mime_type =~ /application|text/ && !Utils.binary?(file.data) + .view_file_content + - ft = handle_file_type(file.name, file.mime_type) + :erb + <%= raw Albino.colorize(content, ft, :html, 'utf-8', "linenos=True") %> + - elsif file.mime_type =~ /image/ + .view_file_content_image + %img{ :src => "data:image/jpeg;base64,#{Base64.encode64(file.data)}"} + - else + %p + %center No preview for this file type + diff --git a/app/views/projects/_tree_item.html.haml b/app/views/projects/_tree_item.html.haml new file mode 100644 index 00000000000..25575283993 --- /dev/null +++ b/app/views/projects/_tree_item.html.haml @@ -0,0 +1,15 @@ +- file = params[:path] ? File.join(params[:path], content.name) : content.name +- content_commit = @repo.log(@branch, file, :max_count => 1).last +- return unless content_commit +%tr{ :class => "tree-item", :url => tree_file_project_path(@project, @commit.id, file) } + %td.tree-item-file-name + - if content.is_a?(Grit::Blob) + = image_tag "txt.png" + - else + = image_tag "dir.png" + = link_to truncate(content.name, :length => 40), tree_file_project_path(@project, @commit.id, file), :remote => :true + %td + = time_ago_in_words(content_commit.committed_date) + ago + %td + = link_to truncate(content_commit.message, :length => 40), project_commit_path(@project, content_commit) diff --git a/app/views/projects/create.js.haml b/app/views/projects/create.js.haml new file mode 100644 index 00000000000..c457527aed4 --- /dev/null +++ b/app/views/projects/create.js.haml @@ -0,0 +1,6 @@ +- if @project.valid? + :plain + location.href = "#{project_path(@project, :notice => 'Project was successfully created.')}"; +- else + :plain + $("#new_project").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb new file mode 100644 index 00000000000..2d3436368bd --- /dev/null +++ b/app/views/projects/edit.html.erb @@ -0,0 +1 @@ +<%= render 'form' %> diff --git a/app/views/projects/empty.html.erb b/app/views/projects/empty.html.erb new file mode 100644 index 00000000000..a8917471550 --- /dev/null +++ b/app/views/projects/empty.html.erb @@ -0,0 +1,49 @@ +<div class=""> + <div class="git-empty"> + <h2>Git global setup:</h2> +<% setup_str = <<eos +git config --global user.name "#{current_user.name}" +git config --global user.email "#{current_user.email}" +eos +%> + <%= raw Albino.colorize(setup_str, :bash) %> + <br /> + <br /> + <h2>Next steps:</h2> +<% repo_setup_str = <<eos +mkdir #{@project.path} +cd #{@project.path} +git init +touch README +git add README +git commit -m 'first commit' +git remote add origin #{@project.url_to_repo} +git push -u origin master +eos +%> + <%= raw Albino.colorize(repo_setup_str, :bash) %> + + <br /><br /> + <h2>Existing Git Repo?</h2> +<% exist_repo_setup_str = <<eos +cd existing_git_repo +git remote add origin #{@project.url_to_repo} +git push -u origin master +eos +%> + <%= raw Albino.colorize(exist_repo_setup_str, :bash) %> + + <br /><br /> + <h2>Remove this project?</h2> + <div class="error"> + <p> + Be careful! <br/> + Project cant be recovered after destroy.</p> + <%= link_to 'Destroy', @project, + :confirm => 'Are you sure?', :method => :delete, + :class => "left button negative span-6", :style => "text-align:center" %> + <div class="clear"></div> + </div> + <br/> + </div> +</div> diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml new file mode 100644 index 00000000000..51717288e73 --- /dev/null +++ b/app/views/projects/index.html.haml @@ -0,0 +1,25 @@ += link_to 'New Project', new_project_path, :class => "lbutton vm" + +%table.round-borders#projects-list + %tr + %th Name + %th Path + %th Code + %th Web + %th Git + %th Admin + %th Actions + + - @projects.each do |project| + %tr{ :class => "project", :url => project_path(project) } + %td= project.name + %td= truncate project.url_to_repo + %td= project.code + %td= check_box_tag "read", 1, project.readers.include?(current_user), :disabled => :disabled + %td= check_box_tag "commit", 1, project.writers.include?(current_user), :disabled => :disabled + %td= check_box_tag "admin", 1, project.admins.include?(current_user), :disabled => :disabled + %td + -if can? current_user, :admin_project, project + = link_to 'Edit', edit_project_path(project), :class => "lbutton positive" +%br + diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb new file mode 100644 index 00000000000..2d3436368bd --- /dev/null +++ b/app/views/projects/new.html.erb @@ -0,0 +1 @@ +<%= render 'form' %> diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml new file mode 100644 index 00000000000..0fd9c8ead19 --- /dev/null +++ b/app/views/projects/show.html.haml @@ -0,0 +1,3 @@ +%div + %div#tree-holder + = render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @commit.tree} diff --git a/app/views/projects/team.html.haml b/app/views/projects/team.html.haml new file mode 100644 index 00000000000..3b2c4b3ef9c --- /dev/null +++ b/app/views/projects/team.html.haml @@ -0,0 +1,3 @@ +%div + = render :partial => "team", :locals => {:project => @project} + diff --git a/app/views/projects/tree.html.erb b/app/views/projects/tree.html.erb new file mode 100644 index 00000000000..c29ed2f90d4 --- /dev/null +++ b/app/views/projects/tree.html.erb @@ -0,0 +1,5 @@ +<div> + <div id="tree-holder"> + <%= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree} %> + </div> +</div> diff --git a/app/views/projects/tree.js.haml b/app/views/projects/tree.js.haml new file mode 100644 index 00000000000..60cbd199165 --- /dev/null +++ b/app/views/projects/tree.js.haml @@ -0,0 +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 table").show("slide", { direction: "right" }, 150); + }); diff --git a/app/views/projects/update.js.haml b/app/views/projects/update.js.haml new file mode 100644 index 00000000000..0188f083735 --- /dev/null +++ b/app/views/projects/update.js.haml @@ -0,0 +1,6 @@ +- if @project.valid? + :plain + location.href = "#{project_path(@project, :notice => 'Project was successfully updated.')}"; +- else + :plain + $(".edit_project").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml new file mode 100644 index 00000000000..479bb3cfc5b --- /dev/null +++ b/app/views/projects/wall.html.haml @@ -0,0 +1 @@ += render "notes/notes" |