Fix #3839: Allow prepopulating upload form with url params.

This commit is contained in:
evazion
2018-08-24 17:27:28 -05:00
parent 05ad112831
commit e10df5bdf7

View File

@@ -27,7 +27,7 @@
<% if CurrentUser.can_upload_free? %> <% if CurrentUser.can_upload_free? %>
<div class="input"> <div class="input">
<label for="upload_as_pending"> <label for="upload_as_pending">
<%= f.check_box :as_pending %> <%= f.check_box :as_pending, :checked => params[:as_pending].present? %>
Upload for approval Upload for approval
</label> </label>
</div> </div>
@@ -44,11 +44,7 @@
<div class="input"> <div class="input">
<%= f.label :source %> <%= f.label :source %>
<% if params[:url].present? %> <%= f.text_field :source, :size => 50, :value => params[:url] %>
<%= f.text_field :source, :size => 50, :value => params[:url] %>
<% else %>
<%= f.text_field :source, :size => 50 %>
<% end %>
<%= button_tag "Similar", :id => "similar-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %> <%= button_tag "Similar", :id => "similar-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<%= button_tag "Artist", :id => "find-artist-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %> <%= button_tag "Artist", :id => "find-artist-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<span class="hint">You can enter a URL to have <%= Danbooru.config.app_name %> automatically download and process it</span> <span class="hint">You can enter a URL to have <%= Danbooru.config.app_name %> automatically download and process it</span>
@@ -58,20 +54,20 @@
<%= f.label :rating %> <%= f.label :rating %>
<fieldset class="ratings"> <fieldset class="ratings">
<%= f.radio_button :rating, :e %> <%= f.radio_button :rating, :e, :checked => (params[:rating] == "e") %>
<%= f.label :rating_e, "Explicit", :title => "Hardcore porn, visible genitals" %> <%= f.label :rating_e, "Explicit", :title => "Hardcore porn, visible genitals" %>
<%= f.radio_button :rating, :q %> <%= f.radio_button :rating, :q, :checked => (params[:rating] == "q") %>
<%= f.label :rating_q, "Questionable", :title => "Nudity, anything erotic" %> <%= f.label :rating_q, "Questionable", :title => "Nudity, anything erotic" %>
<%= f.radio_button :rating, :s %> <%= f.radio_button :rating, :s, :checked => (params[:rating] == "s") %>
<%= f.label :rating_s, "Safe", :title => "Everything else" %> <%= f.label :rating_s, "Safe", :title => "Everything else" %>
</fieldset> </fieldset>
</div> </div>
<div class="input"> <div class="input">
<%= f.label :parent_id, "Parent ID" %> <%= f.label :parent_id, "Parent ID" %>
<%= f.text_field :parent_id %> <%= f.text_field :parent_id, :value => params[:parent_id] %>
</div> </div>
<div class="input"> <div class="input">
@@ -81,17 +77,17 @@
<div class="artist-commentary" style="display: none;"> <div class="artist-commentary" style="display: none;">
<div class="input"> <div class="input">
<%= f.label :artist_commentary_title, "Title" %> <%= f.label :artist_commentary_title, "Title" %>
<%= f.text_field :artist_commentary_title %> <%= f.text_field :artist_commentary_title, :value => params[:artist_commentary_title] %>
</div> </div>
<div class="input"> <div class="input">
<%= f.label :artist_commentary_desc, "Description" %> <%= f.label :artist_commentary_desc, "Description" %>
<%= f.text_area :artist_commentary_desc, :size => "60x5" %> <%= f.text_area :artist_commentary_desc, :size => "60x5", :value => params[:artist_commentary_desc] %>
</div> </div>
<div class="input"> <div class="input">
<label for="upload_include_artist_commentary"> <label for="upload_include_artist_commentary">
<%= f.check_box :include_artist_commentary %> <%= f.check_box :include_artist_commentary, :checked => params[:include_artist_commentary].present? %>
Include Commentary Include Commentary
</label> </label>
</div> </div>
@@ -111,7 +107,7 @@
<div class="input"> <div class="input">
<div> <div>
<%= f.label :tag_string, "Tags" %> <%= f.label :tag_string, "Tags" %>
<%= f.text_area :tag_string, :size => "60x5", :spellcheck => false, :"data-autocomplete" => "tag-edit", :"data-shortcut" => "e" %> <%= f.text_area :tag_string, :size => "60x5", :spellcheck => false, :"data-autocomplete" => "tag-edit", :"data-shortcut" => "e", :value => params[:tag_string] %>
<span id="open-edit-dialog" class="ui-icon ui-icon-arrow-1-ne" title="detach" style="display: none;" data-shortcut="shift+e"/> <span id="open-edit-dialog" class="ui-icon ui-icon-arrow-1-ne" title="detach" style="display: none;" data-shortcut="shift+e"/>
</div> </div>