Skip to content

Commit be858d4

Browse files
committed
updated admin close #12
1 parent c58718d commit be858d4

File tree

3 files changed

+57
-31
lines changed

3 files changed

+57
-31
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The homepage is a simple form asking for the user's email address. This is the p
2525
### Confirmation & Share Page:
2626
The confirmation and share page shows immediately after the user has provided their email address. This page includes his/her trackable referral URL and share buttons. It can be found at **views/users/show**
2727

28-
### Admin page
28+
### Admin
2929
The admin page is where you can view how many people have registered and access their email address. You can edit this file at **views/lock/unlock** though you shouldn't need to.
3030

3131
To access registrations, visit http://www.yoursitehere.com/lock/login. The default password is "password". To change it, overwrite the password file using the following command:
@@ -34,16 +34,15 @@ To access registrations, visit http://www.yoursitehere.com/lock/login. The defau
3434
For more on lock can be found on the [lock gem website](http://www.cowboycoded.com/2011/04/11/lock-down-a-rails-3-app-with-a-single-password-using-lock/).
3535

3636
### Application
37-
Sitewide changes (such as the navigation bar),
38-
**views/layouts/application**
37+
Sitewide changes (such as the navigation bar), can be made from **views/layouts/application**
3938

4039
### Config
4140
Open the **config/application.yml** file to change the following:
4241
- Google analytics (e.g. UA-)
4342
- SEO meta information (e.g. description)
4443
- Facebook meta and social sharing (e.g. share copy and Twitter handle)
4544

46-
## Deploying to Heroku
45+
## Deploying
4746
This code uses SQLite for development but PostgreSQL for production. This is because Heroku only supports PostgreSQL but it's a pain to set up locally. You need to have Heroku installed and set up already for all this goodness to work. Detailed instructions can be found in the [Heroku getting started guide](https://devcenter.heroku.com/articles/rails3).
4847

4948
To create a new heroku site: <code>heroku apps:create exampleName</code>

app/views/lock/login.html.erb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
<b>Login to view the admin dashboard: </b>
2-
<div class="lock-login" id="lock-login-form">
3-
<form accept-charset="UTF-8" action="<%= root_url %>/lock/unlock" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="ch5GAIJSUvsKnlWMiUfAbpuai+s+9l9A4C/A+3tc/44=" /></div>
4-
<input id="password" name="password" type="password" />
5-
<input name="commit" type="submit" value="Unlock" />
6-
</form></div>
1+
<div class="row">
2+
<div class="col-lg-10 col-lg-offset-1">
3+
<b>Login to view the admin dashboard: </b>
4+
<div class="lock-login" id="lock-login-form">
5+
<form accept-charset="UTF-8" action="<%= root_url %>/lock/unlock" method="post">
6+
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="ch5GAIJSUvsKnlWMiUfAbpuai+s+9l9A4C/A+3tc/44=" /></div>
7+
<input id="password" name="password" type="password" />
8+
<input name="commit" type="submit" value="Unlock" />
9+
</form>
10+
</div>
11+
</div>
12+
</div>

app/views/lock/unlock.html.erb

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
<% @users = User.all %>
22

3-
<h1>Listing users</h1>
4-
5-
<table>
6-
<tr>
7-
<th>Email</th>
8-
<th>Code</th>
9-
<th>Count</th>
10-
<th></th>
11-
<th></th>
12-
</tr>
13-
14-
<% @users.each do |user| %>
15-
<tr>
16-
<td><%= user.email %></td>
17-
<td><%= user.code %></td>
18-
<td><%= user.count %></td>
19-
<td><%= link_to 'Show', user %></td>
20-
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
21-
</tr>
22-
<% end %>
23-
</table>
3+
<div class="row">
4+
<div class="col-lg-10 col-lg-offset-1">
5+
<h2><%= ENV['TITLE'] %> Admin Panel</h2>
6+
</div>
7+
</div>
8+
9+
10+
<div class="row">
11+
<div class="col-lg-10 col-lg-offset-1">
12+
<h3><%= User.all.count %> REGISTRATIONS</h3>
13+
</div>
14+
</div>
15+
16+
<div class="row">
17+
<div class="col-lg-10 col-lg-offset-1">
18+
<table class="table-hover table-bordered" cellpadding="5px">
19+
<p>
20+
<thead>
21+
<tr>
22+
<th>Email</th>
23+
<th>Referrals</th>
24+
<th>Registered</th>
25+
<th>Delete</th>
26+
</tr>
27+
</thead>
28+
<% @users.each do |user| %>
29+
<tr>
30+
<td><%= user.email %></td>
31+
<td><%= user.count %></td>
32+
<td><%= user.created_at.to_date %></td>
33+
<td><%= link_to 'Delete', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
34+
</tr>
35+
<% end %>
36+
</table>
37+
</p>
38+
</div>
39+
</div>
40+
41+
42+
43+
44+
2445

0 commit comments

Comments
 (0)