Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New Release: prompt the user to supply a SHA before creating a release

  • Loading branch information...
commit b9cb851da290769e10b6c875ea8a769c011932c4 1 parent eff129c
@boblail authored
View
1  TODO.mdown
@@ -10,7 +10,6 @@
- Test variety of colors
- **Project::Unfuddle**: implement a way of specifying `neq` in Ruby (e.g. `find_tickets(:field_1.neq(197))` or `find_tickets(:deployment.neq(:production))` and have Project figure it out...)
- **Release**:
- - prompt for a SHA before creating
- have option to update Unfuddle tickets on creation
- have option to send an email on creation
- Add Devise and CanCan for authentication
View
15 app/controllers/releases_controller.rb
@@ -27,15 +27,18 @@ def show
# GET /releases/new
# GET /releases/new.json
def new
+ @commit = params[:commit]
@release = @environment.releases.new(
commit0: @environment.last_commit,
- commit1: params[:commit])
+ commit1: @commit)
@release.build_changes_from_commits if @release.can_read_commits?
- @release.changes.build if @release.changes.none?
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @release }
+ if @release.changes.none?
+ render :template => "releases/new_pick_commit"
+ else
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @release }
+ end
end
end
View
29 app/views/releases/new_pick_commit.html.erb
@@ -0,0 +1,29 @@
+<%= header do |p| %>
+ <%= p.breadcrumbs "Projects" => projects_path,
+ @project => Project.all,
+ @environment => @project.environments,
+ "Releases" => project_environment_releases_path(@project, @environment),
+ "New" => nil %>
+<% end %>
+
+<% if @commit.blank? %>
+ <p>What is the SHA of the latest release?</p>
+<% else %>
+ <p>The SHA you specified has no commits on this branch.</p>
+<% end %>
+
+<form accept-charset="UTF-8" action="<%= new_project_environment_release_path(@project, @environment) %>" class="form-horizontal" method="get">
+ <fieldset>
+ <div class="control-group">
+ <%= label_tag :commit, "Commit", :class => "control-label" %>
+ <div class="controls">
+ <%= text_field_tag :commit, @commit, :class => "text_field" %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= submit_tag "Continue", :name => nil, :class => "btn btn-primary" %>
+ <%= link_to "Cancel", releases_path, :class => "btn" %>
+ </div>
+ </fieldset>
+</form>
Please sign in to comment.
Something went wrong with that request. Please try again.