Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users can now upload files by dragging and dropping them to Mockr
- Loading branch information
Chris Chan
committed
Jan 2, 2012
1 parent
1ac4a6c
commit c44d8a4
Showing
9 changed files
with
101 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,32 @@ | ||
<% @title = "Add a Mock" %> | ||
<% @title = "Upload Mocks" %> | ||
<%= stylesheet_link_tag "shared/form" %> | ||
<%= stylesheet_link_tag "mocks/new" %> | ||
<% content_for :head do %> | ||
<%= stylesheet_link_tag "shared/form", | ||
"mocks/new" %> | ||
<%= javascript_include_tag "plugins/jquery.ui.widget", | ||
"plugins/jquery.iframe-transport", | ||
"plugins/jquery.fileupload", | ||
"mocks/new" %> | ||
<% end %> | ||
|
||
<div class="form_holder debossed"> | ||
<% form_for :mock, :url => mocks_path, :html => {:multipart => true} do |f| %> | ||
<% form_for :mock, :url => mocks_path, :html => {:multipart => true, | ||
:id => "mock_creation_form"} do |f| %> | ||
<%= f.hidden_field :path, :value => "" %> | ||
<%= f.hidden_field :author_id, :value => viewer.id %> | ||
<div class="field_row"> | ||
<%= f.label :image %><br /> | ||
<%= f.file_field :image %> | ||
</div> | ||
<% if params[:mock_list_id].blank? %> | ||
<div class="field_row"> | ||
<%= f.label :title %><br /> | ||
<%= f.text_field :title %> | ||
</div> | ||
<% end %> | ||
<div class="field_row"> | ||
<%= f.label :description %><br /> | ||
<%= f.text_area :description %> | ||
</div> | ||
<% if params[:mock_list_id].blank? %> | ||
<div class="field_row"> | ||
<% fields_for :project do |g| %> | ||
<%= g.label :id, "Add to Project:" %> | ||
<%= g.select :id, Project.form_options, | ||
{:selected => params[:project_id].to_i, | ||
:disabled => Project::DISABLED_PROJECT_FORM_VALUE} %> | ||
<% end %> | ||
</div> | ||
<% else %> | ||
<%= f.hidden_field :mock_list_id, :value => params[:mock_list_id] %> | ||
<% end %> | ||
<%= check_box_tag :send_email %> | ||
<% if Setting[:notification_email] %> | ||
Send email to | ||
<span id="default_email"> | ||
<strong><%= Setting[:notification_email] %></strong> | ||
<%= link_to_function "change", | ||
"$('#email').show().select(); $('#default_email').hide()" %> | ||
</span> | ||
<%= text_field_tag :email, Setting[:notification_email], | ||
:style => "display: none" %> | ||
<% else %> | ||
<%= label_tag :send_email, "Send email to" %> | ||
<%= text_field_tag :email %> | ||
<% end %> | ||
|
||
<div class="submit_bar"> | ||
<% if params[:project_id] %> | ||
<%= link_to "Cancel", project_path(params[:project_id]) %> | ||
<% else %> | ||
<%= link_to "Cancel", home_path %> | ||
<% end %> | ||
or <%= f.submit "Create Mock" %> | ||
</div> | ||
<input type="file" name="images[]" id='file' multiple | ||
style="display: none" /> | ||
<%= f.hidden_field :mock_list_id, :value => params[:mock_list_id] %> | ||
<%= hidden_field_tag :project_id, params[:project_id] %> | ||
<div class="instructions">Drag & Drop Your Files to Upload</div> | ||
<div class="loading rounded"></div> | ||
<% end %> | ||
</div> | ||
|
||
<p class="cancel_bar"> | ||
<% if params[:project_id] %> | ||
<%= link_to "Back to Project", project_path(params[:project_id]) %> | ||
<% else %> | ||
<%= link_to "Back to Home", home_path %> | ||
<% end %> | ||
</p> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$(function() { | ||
$('#mock_creation_form').fileupload({ | ||
dataType: 'json', | ||
url: '/mocks', | ||
singleFileUploads: false, | ||
done: function (e, data) { | ||
window.location = '/?uploaded=1'; | ||
}, | ||
start: function (e) { | ||
$(this).addClass('submitted'); | ||
}, | ||
fail: function (e, data) { | ||
window.location = '/?uploaded=0'; | ||
}, | ||
dragover: function(e, data) { | ||
$(document.body).addClass("dragging"); | ||
} | ||
}); | ||
$(document.body).bind('dragleave', function() { | ||
$(document.body).removeClass("dragging"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
.submit_bar { | ||
border-top: 1px solid #666; | ||
margin-top: 20px; | ||
padding-top: 20px; | ||
} | ||
#default_email a { | ||
font-size: 11px; | ||
} | ||
#email { | ||
font-size: 13px; | ||
margin: 0; | ||
width: 250px; | ||
.cancel_bar { | ||
margin-top: 40px; | ||
text-align: center; | ||
} | ||
.form_holder { | ||
padding: 180px 80px; | ||
} | ||
.dragging .form_holder { | ||
background: #111; | ||
} | ||
.loading { | ||
display: none; | ||
height: 22px; | ||
line-height: 22px; | ||
background: url('../../images/progressbar.gif') repeat-x; | ||
} | ||
.instructions { | ||
background: url('../../images/upload-files.png') no-repeat center top; | ||
color: #ccc; | ||
font-size: 20px; | ||
font-weight: bold; | ||
padding-top: 120px; | ||
text-align: center; | ||
} | ||
.submitted * { | ||
display: none; | ||
} | ||
.submitted .loading { | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters