Milestone basic scaffold

This commit is contained in:
Dmitriy Zaporozhets 2012-04-09 00:28:58 +03:00
parent 667edcdd75
commit 23d950855d
28 changed files with 424 additions and 36 deletions

View file

@ -9,18 +9,25 @@
%li= msg
.clearfix
= f.label :title, "Issue Subject"
.input= f.text_field :title, :maxlength => 255, :class => "xxlarge"
= f.label :title, "Issue Subject *"
.input
= f.text_field :title, :maxlength => 255, :class => "xxlarge"
.clearfix
= f.label :assignee_id, "Assign to *"
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Assign to user" })
.clearfix
= f.label :description, "Issue Details"
.input
= f.text_area :description, :maxlength => 2000, :class => "xxlarge", :rows => 10
%p.hint Markdown is enabled.
.clearfix
= f.label :assignee_id
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Assign to user" })
= f.label :milestone_id
.input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { :include_blank => "Select milestone" })
.clearfix
= f.label :critical, "Critical"

View file

@ -1,4 +1,7 @@
.tabs
%li{:class => "#{'active' if current_page?(project_issues_path(@project))}"}
= link_to project_issues_path(@project), :class => "tab" do
Issues
Browse Issues
%li{:class => "#{'active' if current_page?(project_milestones_path(@project))}"}
= link_to project_milestones_path(@project), :class => "tab" do
Milestones

View file

@ -10,3 +10,6 @@
.span10= paginate @issues, :remote => true, :theme => "gitlab"
.span4.right
%span.cgray.right #{@issues.total_count} issues for this filter
- else
%li
%p.padded Nothing to show here

View file

@ -3,5 +3,6 @@
:javascript
$(function(){
$('select#issue_assignee_id').chosen();
$('select#issue_milestone_id').chosen();
});

View file

@ -1,3 +1,4 @@
= render "issues/head"
.issues_content
%h3
Issues
@ -5,14 +6,22 @@
= link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do
= image_tag "Rss-UI.PNG", :width => 16, :title => "feed"
- if can? current_user, :write_issue, @project
= link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do
New Issue
.right
.span4.left
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :left 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' }
- if can? current_user, :write_issue, @project
.span2.left
= link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do
New Issue
%br
%div#issues-table-holder.ui-box
.title
.row
.span8
.span6
%ul.pills.left
%li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
= link_to project_issues_path(@project, :f => 0) do
@ -27,17 +36,13 @@
= link_to project_issues_path(@project, :f => 1) do
All
.span3.right
= 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' }
.span6.right
= form_tag project_issues_path(@project), :method => :get, :class => :right do
= select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Select milestone")
%ul#issues-table.unstyled
= render "issues"
- if @issues.blank?
%li
%p.padded Nothing to show here
:javascript
var href = $('.issue_search').parent().attr('action');
var last_terms = '';
@ -65,9 +70,8 @@
$('#issues-table').sortable({
axis: 'y',
dropOnEmpty: false,
handle: '.handle',
cursor: 'crosshair',
items: 'tr',
handle: '.avatar',
items: 'li',
opacity: 0.4,
scroll: true,
update: function(){
@ -85,4 +89,8 @@
$(function(){
setSortable();
$("#milestone_id").chosen();
$("#milestone_id").live("change", function(){
$(this).closest("form").submit();
});
});

View file

@ -3,5 +3,6 @@
:javascript
$(function(){
$('select#issue_assignee_id').chosen();
$('select#issue_milestone_id').chosen();
});

View file

@ -0,0 +1,54 @@
%h3= @milestone.new_record? ? "New Milestone" : "Edit Milestone ##{@milestone.id}"
.back_link
= link_to project_milestones_path(@project) do
← To milestones
%hr
= form_for [@project, @milestone] do |f|
-if @milestone.errors.any?
.alert-message.block-message.error
%ul
- @milestone.errors.full_messages.each do |msg|
%li= msg
.row
.span7
.clearfix
= f.label :title, "Title"
.input
= f.text_field :title, :maxlength => 255, :class => "xlarge"
%p.hint Required
.clearfix
= f.label :description, "Description"
.input
= f.text_area :description, :maxlength => 2000, :class => "xlarge", :rows => 10
%p.hint Markdown is enabled.
.span8
.clearfix
= f.label :due_date, "Due Date"
.input= f.hidden_field :due_date
.input
.datepicker
.actions
- if @milestone.new_record?
= f.submit 'Create milestone', :class => "primary btn"
-else
= f.submit 'Save changes', :class => "primary btn"
- if request.xhr?
= link_to "Cancel", "#back", :onclick => "backToIssues();", :class => "btn"
- else
- if @milestone.new_record?
= link_to "Cancel", project_milestones_path(@project), :class => "btn"
- else
= link_to "Cancel", project_milestone_path(@project, @milestone), :class => "btn"
:javascript
$(function() {
$( ".datepicker" ).datepicker({
dateFormat: "yy-mm-dd",
onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) }
});
});

View file

@ -0,0 +1,21 @@
%li{:class => "wll", :id => dom_id(milestone) }
.right
- if milestone.issues.count > 0
= link_to 'Browse Issues', project_issues_path(milestone.project, :milestone_id => milestone.id), :class => "btn small"
- if milestone.issues.any?
%span.btn.small.disabled.padded= pluralize milestone.issues.count, 'issues'
- if can? current_user, :admin_milestone, milestone.project
= link_to 'Edit', edit_project_milestone_path(milestone.project, milestone), :class => "btn small edit-milestone-link"
= link_to project_milestone_path(milestone.project, milestone) do
%h4.row_title
= truncate(milestone.title, :length => 100)
%small= milestone.expires_at
.progress.span4
:javascript
$(function() {
$( "##{dom_id(milestone)} .progress" ).progressbar({
value: #{milestone.percent_complete}
});
});

View file

@ -0,0 +1,7 @@
= render "form"
:javascript
$(function(){
$('select#issue_assignee_id').chosen();
});

View file

@ -0,0 +1,25 @@
= render "issues/head"
.milestones_content
%h3
Milestones
- if can? current_user, :admin_milestone, @project
= link_to "New Milestone", new_project_milestone_path(@project), :class => "right btn small", :title => "New Milestone"
%br
%div.ui-box
.title
%ul.pills
%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
All
%ul.unstyled
= render @milestones
- if @milestones.present?
%li.bottom= paginate @milestones, :remote => true, :theme => "gitlab"
- else
%li
%p.padded Nothing to show here

View file

@ -0,0 +1 @@
= render "form"

View file

@ -0,0 +1,50 @@
%h3
Milestone ##{@milestone.id}
%small
= @milestone.expires_at
%span.right
- if can?(current_user, :admin_milestone, @project)
= link_to edit_project_milestone_path(@project, @milestone), :class => "btn" do
Edit
.back_link
= link_to project_milestones_path(@project) do
← To milestones list
.main_box
.top_box_content
%h5
- if @milestone.closed
.alert-message.error.status_info Closed
- else
.alert-message.success.status_info Open
= @milestone.title
.middle_box_content
.row
.span2
= link_to 'Browse Issues', project_issues_path(@milestone.project, :milestone_id => @milestone.id), :class => "btn small edit-milestone-link"
.span4
%span
= @milestone.expires_at
.span4.right
.progress
%br
%span
#{@milestone.issues.opened.count} open
–
#{@milestone.issues.closed.count} closed
- if @milestone.description.present?
.bottom_box_content
= markdown @milestone.description
:javascript
$(function() {
$( ".progress" ).progressbar({
value: #{@milestone.percent_complete}
});
});