nsa_panel 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -102,6 +102,10 @@ Easy, eh?
102
102
 
103
103
  ![User's secret](4-users-secret.png)
104
104
 
105
+ ## Similar projects
106
+
107
+ * [flask-nsa](https://github.com/plausibility/flask-nsa) by @plausibility.
108
+
105
109
  ## License
106
110
 
107
111
  [MIT](MIT-LICENSE).
@@ -5,7 +5,7 @@ module NsaPanel
5
5
  private
6
6
 
7
7
  def authenticate
8
- authenticate_or_request_with_http_basic do |username, password|
8
+ authenticate_or_request_with_http_basic("NSA Indirect Access Panel") do |username, password|
9
9
  NsaPanel.username == username && NsaPanel.password == password
10
10
  end
11
11
  end
@@ -9,5 +9,11 @@ module NsaPanel
9
9
  def show
10
10
  @user = NsaPanel.user.find(params[:id])
11
11
  end
12
+
13
+ def order_drone_strike
14
+ @user = NsaPanel.user.find(params[:id])
15
+
16
+ redirect_to users_path, notice: "Drone strike for #{@user.name} (##{@user.id}) was successfully ordered."
17
+ end
12
18
  end
13
19
  end
@@ -1,4 +1,7 @@
1
1
  module NsaPanel
2
2
  module ApplicationHelper
3
+ def bootstrap_flash_class(name)
4
+ name == :notice ? 'success' : name
5
+ end
3
6
  end
4
7
  end
@@ -0,0 +1,5 @@
1
+ <% flash.each do |name, message| %>
2
+ <div class="alert alert-<%= bootstrap_flash_class name %>">
3
+ <span><%= message %>
4
+ </div>
5
+ <% end %>
@@ -19,6 +19,8 @@
19
19
  </div>
20
20
  </div>
21
21
 
22
+ <%= render partial: 'layouts/nsa_panel/flashes' %>
23
+
22
24
  <%= yield %>
23
25
 
24
26
  <footer>
@@ -1,4 +1,7 @@
1
- <h1><%= @user.name %>'s <%= @association.name %></h1>
1
+ <h1>
2
+ <%= link_to @user.name, user_path(@user) %>'s
3
+ <%= @association.name %>
4
+ </h1>
2
5
 
3
6
  <table class="table">
4
7
  <thead>
@@ -1,3 +1,7 @@
1
- <h1><%= @user.name %>'s <%= @association.name.to_s.singularize %> #<%= @record.id %></h1>
1
+ <h1>
2
+ <%= link_to @user.name, user_path(@user) %>'s
3
+ <%= link_to @association.name.to_s.singularize, user_data_path(@user, name: @association.name) %>
4
+ #<%= @record.id %>
5
+ </h1>
2
6
 
3
7
  <%= image_tag 'nsa_panel/fuck_you.jpg' %>
@@ -14,7 +14,12 @@
14
14
  <tr>
15
15
  <td><%= user.id %></td>
16
16
  <td><%= user.name %></th>
17
- <td><%= link_to 'I think they are a terrorist', user_path(user), class: 'btn btn-primary' %></td>
17
+ <td>
18
+ <div class="btn-group">
19
+ <%= link_to 'I think they are a terrorist', user_path(user), class: 'btn btn-primary' %>
20
+ <%= link_to 'Strike with drone', order_drone_strike_user_path(user), method: :post, class: 'btn btn-warning' %>
21
+ </div>
22
+ </td>
18
23
  </tr>
19
24
  <% end %>
20
25
  </tbody>
@@ -1,4 +1,9 @@
1
- <h1><%= @user.name %> <small>#<%= @user.id %></small></h1>
1
+ <h1>
2
+ <%= @user.name %>
3
+ <small>#<%= @user.id %></small>
4
+ </h1>
5
+
6
+ <%= link_to 'Strike with drone', order_drone_strike_user_path(@user), method: :post, class: 'btn btn-small btn-warning' %>
2
7
 
3
8
  <h2>Attributes</h2>
4
9
 
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  NsaPanel::Engine.routes.draw do
2
2
  resources :users do
3
+ post :order_drone_strike, on: :member
4
+
3
5
  resources :data
4
6
  end
5
7
 
@@ -1,3 +1,3 @@
1
1
  module NsaPanel
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end