diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/downloads/_form.html.erb | 37 | ||||
-rw-r--r-- | app/views/downloads/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/downloads/index.html.erb | 35 | ||||
-rw-r--r-- | app/views/downloads/index.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/downloads/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/downloads/show.html.erb | 29 | ||||
-rw-r--r-- | app/views/downloads/show.json.jbuilder | 1 |
7 files changed, 117 insertions, 0 deletions
diff --git a/app/views/downloads/_form.html.erb b/app/views/downloads/_form.html.erb new file mode 100644 index 0000000..1ab1879 --- /dev/null +++ b/app/views/downloads/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for(@download) do |f| %> + <% if @download.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@download.errors.count, "error") %> prohibited this download from being saved:</h2> + + <ul> + <% @download.errors.full_messages.each do |message| %> + <li><%= message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :name %><br> + <%= f.text_field :name %> + </div> + <div class="field"> + <%= f.label :filename %><br> + <%= f.text_field :filename %> + </div> + <div class="field"> + <%= f.label :type %><br> + <%= f.text_field :type %> + </div> + <div class="field"> + <%= f.label :description %><br> + <%= f.text_area :description %> + </div> + <div class="field"> + <%= f.label :hits %><br> + <%= f.number_field :hits %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/downloads/edit.html.erb b/app/views/downloads/edit.html.erb new file mode 100644 index 0000000..3b57a65 --- /dev/null +++ b/app/views/downloads/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing Download</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @download %> | +<%= link_to 'Back', downloads_path %> diff --git a/app/views/downloads/index.html.erb b/app/views/downloads/index.html.erb new file mode 100644 index 0000000..c017aab --- /dev/null +++ b/app/views/downloads/index.html.erb @@ -0,0 +1,35 @@ +<p id="notice"><%= notice %></p> + +<h1>Listing Downloads</h1> + +<table> + <thead> + <tr> + <th>Name</th> + <th>Filename</th> + <th>Type</th> + <th>Description</th> + <th>Hits</th> + <th colspan="3"></th> + </tr> + </thead> + + <tbody> + <% @downloads.each do |download| %> + <tr> + <td><%= download.name %></td> + <td><%= download.filename %></td> + <td><%= download.type %></td> + <td><%= download.description %></td> + <td><%= download.hits %></td> + <td><%= link_to 'Show', download %></td> + <td><%= link_to 'Edit', edit_download_path(download) %></td> + <td><%= link_to 'Destroy', download, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Download', new_download_path %> diff --git a/app/views/downloads/index.json.jbuilder b/app/views/downloads/index.json.jbuilder new file mode 100644 index 0000000..3323b04 --- /dev/null +++ b/app/views/downloads/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@downloads) do |download| + json.extract! download, :id, :name, :filename, :type, :description, :hits + json.url download_url(download, format: :json) +end diff --git a/app/views/downloads/new.html.erb b/app/views/downloads/new.html.erb new file mode 100644 index 0000000..ac31df5 --- /dev/null +++ b/app/views/downloads/new.html.erb @@ -0,0 +1,5 @@ +<h1>New Download</h1> + +<%= render 'form' %> + +<%= link_to 'Back', downloads_path %> diff --git a/app/views/downloads/show.html.erb b/app/views/downloads/show.html.erb new file mode 100644 index 0000000..276888a --- /dev/null +++ b/app/views/downloads/show.html.erb @@ -0,0 +1,29 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>Name:</strong> + <%= @download.name %> +</p> + +<p> + <strong>Filename:</strong> + <%= @download.filename %> +</p> + +<p> + <strong>Type:</strong> + <%= @download.type %> +</p> + +<p> + <strong>Description:</strong> + <%= @download.description %> +</p> + +<p> + <strong>Hits:</strong> + <%= @download.hits %> +</p> + +<%= link_to 'Edit', edit_download_path(@download) %> | +<%= link_to 'Back', downloads_path %> diff --git a/app/views/downloads/show.json.jbuilder b/app/views/downloads/show.json.jbuilder new file mode 100644 index 0000000..6bab62c --- /dev/null +++ b/app/views/downloads/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @download, :id, :name, :filename, :type, :description, :hits, :created_at, :updated_at |