Skip to content

Commit

Permalink
delete generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kiryanenko committed Nov 26, 2016
1 parent 090982a commit 44a4aad
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 268 deletions.
404 changes: 164 additions & 240 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,4 @@ gem 'pg_search'
gem 'will_paginate'
gem 'will_paginate-bootstrap'
gem 'rmagick'
gem 'rails_12factor', group: :production

ruby "2.1.2"
gem 'rails_12factor', group: :production
2 changes: 1 addition & 1 deletion app/controllers/generations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def create
def destroy
@generation.destroy
respond_to do |format|
format.html { redirect_to generations_url, notice: 'Generation was successfully destroyed.' }
format.html { redirect_to '/', notice: 'Сгенерированные варианты были успешно удалены.' }
format.json { head :no_content }
end
end
Expand Down
21 changes: 21 additions & 0 deletions app/views/generations/_list_item.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<a href="<%= generation_path generation %>" class="list-group-item list-group-item-action">
<button href="javascript: document.getElementById('form-destroy_generation_<%= generation.id %>').submit()" class="close"
aria-hidden="true" data-toggle="confirmation" data-placement="left"
title="Вы уверены, что хотите удалить эти сгенерированные варианты?">×</button>
<%= form_tag generation_path(generation), method: 'delete', id: 'form-destroy_generation_' + generation.id.to_s do end %>

<h5 style="margin: 0px;">
<%= generation.title %>
</h5>

<table width="100%">
<tr>
<td><p class="list-group-item-buttom">
<small><%= generation.variants.size %> вариантов</small>
</p></td>
<td width="80px" valign="bottom">
<span class="pull-right text-muted small"><em><%= generation.updated_at.to_formatted_s(:short) %></em></span>
</td>
</tr>
</table>
</a>
7 changes: 1 addition & 6 deletions app/views/generations/my_generations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
<% else %>
<div class="list-group">
<% @generations.each do |g| %>
<a href="/generations/<%= g.id %>" class="list-group-item list-group-item-action">
<span class="pull-right text-muted small"><em><%= g.updated_at.to_formatted_s(:short) %></em></span>
<h4 class="list-group-item-heading"><%= g.title %><br>
<small>Сгенерироваано <%= g.variants.size %> вариантов</small>
</h4>
</a>
<%= render 'generations/list_item', generation: g %>
<% end %>
</div>

Expand Down
8 changes: 1 addition & 7 deletions app/views/main_page/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@
<% else %>
<div class="list-group">
<% @generations.each do |g| %>
<a href="/generations/<%= g.id %>" class="list-group-item list-group-item-action">
<span class="pull-right text-muted small"><em><%= g.updated_at.to_formatted_s(:short) %></em></span>
<h5 style="margin: 0px;">
<%= g.title %><br>
<small><%= g.variants.size %> вариантов</small>
</h5>
</a>
<%= render 'generations/list_item', generation: g %>
<% end %>
</div>
<a href="/generations/my" class="btn btn-default btn-block">Посмотреть все</a>
Expand Down
12 changes: 7 additions & 5 deletions app/views/question_cards/_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<a href="<%= edit_question_card_path(card) %>" type="button" class="btn btn-warning btn-circle btn-xs" data-placement="bottom" data-toggle="tooltip" title="Редактировать">
<i class="fa fa-edit"></i>
</a>
<a href="javascript: document.getElementById('form-destroy_<%= card.id %>').submit()"
class="btn btn-danger btn-circle btn-xs" aria-hidden="true" data-toggle="confirmation"
data-placement="bottom" title="Вы уверены, что хотите удалить этот билет?">
<i class="fa fa-trash-o"></i>
<a href="javascript: document.getElementById('form-destroy_card_<%= card.id %>').submit()" aria-hidden="true"
data-toggle="confirmation" data-placement="bottom" title="Вы уверены, что хотите удалить этот билет?">
<button type="button" class="btn btn-danger btn-circle btn-xs" data-toggle="tooltip"
data-placement="bottom" title="Удалить" data-trigger="hover">
<i class="fa fa-trash-o"></i>
</button>
</a>
<% else %>
<a href="<%= question_card_path card %>/add_to_me" class="btn btn-success btn-circle btn-xs"
Expand All @@ -23,7 +25,7 @@
<% end %>
</div>
<h4 class="list-group-item-heading "><%= card.title %></h4>
<%= form_tag question_card_path(card), method: 'delete', id: 'form-destroy_' + card.id.to_s do end %>
<%= form_tag question_card_path(card), method: 'delete', id: 'form-destroy_card_' + card.id.to_s do end %>
</td></tr></table>

<p class="list-group-item-text list-group-item-description"><%= card.description %></p>
Expand Down
4 changes: 2 additions & 2 deletions app/views/tasks/_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<i class="fa fa-edit"></i>
</a>

<a href="javascript: document.getElementById('form-destroy_<%= task.id %>').submit()" aria-hidden="true"
<a href="javascript: document.getElementById('form-destroy_task_<%= task.id %>').submit()" aria-hidden="true"
data-toggle="confirmation" data-placement="bottom" title="Вы уверены, что хотите удалить эту задачу?">
<button type="button" class="btn btn-danger btn-circle btn-xs" data-toggle="tooltip"
data-placement="bottom" title="Удалить" data-trigger="hover">
Expand All @@ -27,7 +27,7 @@
</a>
<% end %>
</div>
<%= form_tag task_path(task), method: 'delete', id: 'form-destroy_' + task.id.to_s do end %>
<%= form_tag task_path(task), method: 'delete', id: 'form-destroy_task_' + task.id.to_s do end %>
<% end %>
<h4 class="list-group-item-heading "><%= task.title %></h4>
</td></tr></table>
Expand Down
11 changes: 7 additions & 4 deletions app/views/tasks_groups/_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
title="Редактировать">
<i class="fa fa-edit"></i>
</a>
<a href="javascript: document.getElementById('form-destroy_<%= group.id %>').submit()"
class="btn btn-danger btn-circle btn-xs" aria-hidden="true" data-toggle="confirmation" data-placement="bottom"
<a href="javascript: document.getElementById('form-destroy-tasks_group_<%= group.id %>').submit()"
aria-hidden="true" data-toggle="confirmation" data-placement="bottom"
title="Вы уверены, что хотите удалить эту группу задач?">
<i class="fa fa-trash-o"></i>
<button type="button" class="btn btn-danger btn-circle btn-xs" data-toggle="tooltip"
data-placement="bottom" title="Удалить" data-trigger="hover">
<i class="fa fa-trash-o"></i>
</button>
</a>
<% else %>
<a href="<%= tasks_group_path group %>/add_to_me" class="btn btn-success btn-circle"
Expand All @@ -22,7 +25,7 @@
<% end %>
</div>
<h4 class="list-group-item-heading"><%= group.title %></h4>
<%= form_tag tasks_group_path(group), method: 'delete', id: 'form-destroy_' + group.id.to_s do end %>
<%= form_tag tasks_group_path(group), method: 'delete', id: 'form-destroy-tasks_group_' + group.id.to_s do end %>
</td></tr></table>

<p class="list-group-item-text list-group-item-description"><%= group.description %></p>
Expand Down

0 comments on commit 44a4aad

Please sign in to comment.