overlook 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +0,0 @@
1
- /*
2
- *= require admin/bootstrap
3
- *= require_self
4
- */
5
-
6
- body { padding-top: 60px; }
7
- div.sidebar { padding: 8px 0; }
8
- td.options div.btn-group { width: 110px; }
9
- table.table td { vertical-align: middle; }
10
- td.center { text-align: center; }
11
- td.right { text-align: right; }
12
-
Binary file
@@ -1,3 +0,0 @@
1
- class Admin::ApplicationController < ApplicationController
2
- layout 'admin'
3
- end
@@ -1,82 +0,0 @@
1
- require 'csv'
2
-
3
- class Admin::ArticlesController < Admin::ApplicationController
4
- # filters
5
- before_filter :load_article, only: [:show, :edit, :update, :destroy]
6
-
7
- # index
8
- def index
9
- @articles = Article.search(params[:q]).sorty(params)
10
-
11
- respond_to do |format|
12
- format.html do
13
- @articles = @articles.page(params[:page])
14
- end
15
-
16
- format.csv do
17
- data = CSV.generate do |csv|
18
- columns = Article.columns.map(&:name)
19
- csv << columns.map(&:titleize)
20
-
21
- @articles.map do |article|
22
- csv << columns.map{|c| article.send(c)}
23
- end
24
- end
25
-
26
- filename = "articles-#{Time.now.strftime('%d-%m-%Y')}.csv"
27
- send_data(data, filename: filename, type: 'text/csv')
28
- end
29
- end
30
- end
31
-
32
- # show
33
- def show
34
-
35
- end
36
-
37
- # new
38
- def new
39
- @article = Article.new
40
- end
41
-
42
- # create
43
- def create
44
- @article = Article.new(params[:article])
45
-
46
- if @article.save
47
- redirect_to admin_articles_url, notice: "Article has been created"
48
- else
49
- render :new
50
- end
51
- end
52
-
53
- # edit
54
- def edit
55
-
56
- end
57
-
58
- # update
59
- def update
60
- if @article.update_attributes(params[:article])
61
- redirect_to admin_articles_url, notice: "Article has been updated"
62
- else
63
- render :edit
64
- end
65
- end
66
-
67
- # destroy
68
- def destroy
69
- @article.destroy
70
-
71
- respond_to do |format|
72
- format.html { redirect_to :back, notice: "Article has been deleted" }
73
- format.js
74
- end
75
- end
76
-
77
- protected
78
-
79
- def load_article
80
- @article = Article.find(params[:id])
81
- end
82
- end
@@ -1,76 +0,0 @@
1
- require 'csv'
2
-
3
- class Admin::UsersController < Admin::ApplicationController
4
- # filters
5
- before_filter :load_user, only: [:edit, :update, :destroy]
6
-
7
- # index
8
- def index
9
- @users = User.search(params[:q]).sorty(params)
10
-
11
- respond_to do |format|
12
- format.html do
13
- @users = @users.page(params[:page])
14
- end
15
- format.csv do
16
- data = CSV.generate do |csv|
17
- columns = User.columns.map(&:name)
18
- csv << columns.map(&:titleize)
19
-
20
- @users.map do |user|
21
- csv << columns.map{|c| user.send(c)}
22
- end
23
- end
24
-
25
- filename = "users-#{Time.now.strftime('%d-%m-%Y')}.csv"
26
- send_data(data, filename: filename, type: 'text/csv')
27
- end
28
- end
29
- end
30
-
31
- # new
32
- def new
33
- @user = User.new
34
- end
35
-
36
- # create
37
- def create
38
- @user = User.new(params[:user])
39
-
40
- if @user.save
41
- redirect_to admin_users_url, notice: "User has been created"
42
- else
43
- render :new
44
- end
45
- end
46
-
47
- # edit
48
- def edit
49
-
50
- end
51
-
52
- # update
53
- def update
54
- if @user.update_attributes(params[:user])
55
- redirect_to admin_users_url, notice: "User has been updated"
56
- else
57
- render :edit
58
- end
59
- end
60
-
61
- # destroy
62
- def destroy
63
- @user.destroy
64
-
65
- respond_to do |format|
66
- format.html { redirect_to :back, notice: "User has been deleted" }
67
- format.js
68
- end
69
- end
70
-
71
- protected
72
-
73
- def load_user
74
- @user = User.find(params[:id])
75
- end
76
- end
Binary file
@@ -1,26 +0,0 @@
1
- module Admin::ApplicationHelper
2
- def flash_messages
3
- classes = { notice: 'success', warning: 'warning', error: 'error' }
4
-
5
- output = flash.map do |name, message|
6
- if message.present?
7
- class_name = ['alert', "alert-#{classes[name]}"].join(' ')
8
- message << '<a class="close" data-dismiss="alert">&times;</a>'
9
-
10
- content_tag(:div, class: 'span12') do
11
- content_tag(:div, raw(message), class: class_name)
12
- end
13
- end
14
- end
15
-
16
- raw(output.join)
17
- end
18
-
19
- def nav(name)
20
- class_name = params[:controller].eql?("admin/#{name}") ? 'active' : nil
21
-
22
- content_tag(:li, class: class_name) do
23
- link_to(name.to_s.titleize, "/admin/#{name}")
24
- end
25
- end
26
- end
data/app/views/.DS_Store DELETED
Binary file
@@ -1,8 +0,0 @@
1
- <%# Non-link tag that stands for skipped pages...
2
- - available local variables
3
- current_page: a page object for the currently displayed page
4
- num_pages: total number of pages
5
- per_page: number of items to fetch per page
6
- remote: data-remote
7
- -%>
8
- <li class="disabled"><a href="#"><%= raw(t 'views.pagination.truncate') %></a></li>
@@ -1,11 +0,0 @@
1
- <%# Link to the "Next" page
2
- - available local variables
3
- url: url to the next page
4
- current_page: a page object for the currently displayed page
5
- num_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <li class="<%= 'disabled' if current_page.last? %>">
10
- <%= link_to raw("&raquo;"), url, :rel => 'next', :remote => remote %>
11
- </li>
@@ -1,12 +0,0 @@
1
- <%# Link showing page number
2
- - available local variables
3
- page: a page object for "this" page
4
- url: url to this page
5
- current_page: a page object for the currently displayed page
6
- num_pages: total number of pages
7
- per_page: number of items to fetch per page
8
- remote: data-remote
9
- -%>
10
- <li class="<%= 'active' if page.current? %>">
11
- <%= link_to page, url, opts = { :remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
12
- </li>
@@ -1,23 +0,0 @@
1
- <%# The container tag
2
- - available local variables
3
- current_page: a page object for the currently displayed page
4
- num_pages: total number of pages
5
- per_page: number of items to fetch per page
6
- remote: data-remote
7
- paginator: the paginator that renders the pagination tags inside
8
- -%>
9
- <%= paginator.render do -%>
10
- <div class="pagination pagination-centered">
11
- <ul>
12
- <%= prev_page_tag unless current_page.first? %>
13
- <% each_page do |page| -%>
14
- <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
15
- <%= page_tag page %>
16
- <% elsif !page.was_truncated? -%>
17
- <%= gap_tag %>
18
- <% end -%>
19
- <% end -%>
20
- <%= next_page_tag unless current_page.last? %>
21
- </ul>
22
- </div>
23
- <% end -%>
@@ -1,11 +0,0 @@
1
- <%# Link to the "Previous" page
2
- - available local variables
3
- url: url to the previous page
4
- current_page: a page object for the currently displayed page
5
- num_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <li class="<%= 'disabled' if current_page.first? %>">
10
- <%= link_to raw("&laquo;"), url, :rel => 'prev', :remote => remote %>
11
- </li>
Binary file
@@ -1,30 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title><%= @page_title || 'Admin' %></title>
6
- <%= stylesheet_link_tag "admin", media: "all" %>
7
- <%= csrf_meta_tags %>
8
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
- </head>
10
- <body>
11
- <div class="navbar navbar-fixed-top">
12
- <div class="navbar-inner">
13
- <div class="container">
14
- <a class="brand" href="/admin">Admin</a>
15
- <ul class="nav">
16
- <%= nav(:users) %>
17
- <%= nav(:articles) %>
18
- </ul>
19
- </div>
20
- </div>
21
- </div>
22
- <div class="container">
23
- <div class="row">
24
- <%= flash_messages %>
25
- <%= yield %>
26
- </div>
27
- </div>
28
- <%= javascript_include_tag "admin" %>
29
- </body>
30
- </html>