Changeset 1800
- Timestamp:
- 09/11/08 10:51:38 (4 months ago)
- Files:
-
- community_hive/trunk/community_hive_web/app/controllers/account_controller.rb (modified) (2 diffs)
- community_hive/trunk/community_hive_web/app/helpers/application_helper.rb (modified) (3 diffs)
- community_hive/trunk/community_hive_web/app/helpers/users_helper.rb (modified) (1 diff)
- community_hive/trunk/community_hive_web/app/views/main/index.html.erb (modified) (1 diff)
- community_hive/trunk/community_hive_web/app/views/statistics/index.html.erb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
community_hive/trunk/community_hive_web/app/controllers/account_controller.rb
r1793 r1800 5 5 self.current_user = User.authenticate(params[:login], params[:password]) 6 6 if logged_in? 7 redirect_back_or_default( :controller => '/main', :action => 'index')7 redirect_back_or_default('/') 8 8 flash[:success] = "Logged in successfully" 9 9 else … … 17 17 cookies.delete :auth_token 18 18 flash[:success] = "You have been logged out." 19 redirect_back_or_default( :controller => '/account', :action => 'login')19 redirect_back_or_default('/signin') 20 20 end 21 21 end community_hive/trunk/community_hive_web/app/helpers/application_helper.rb
r1785 r1800 2 2 module ApplicationHelper 3 3 4 def menu5 home = menu_element("Submit a Url",root_path())6 check = menu_element("Search Catalog",urls_path())7 [home, check]8 end9 10 def menu_element(content, address)11 { :content => content, :href => address }12 end13 14 def menu_link_to(link, options = {})15 link_to(link[:content], link[:href], options)16 end17 18 def menu_li(link, options = {})19 klass = "n-#{link[:content].downcase}"20 klass += " active" if current_page?(link[:href])21 content_tag(:li, menu_link_to(link, options), :class => klass)22 end23 24 def loginbar25 bar = []26 if logged_in?27 bar << "#{current_user.login}"28 bar << "#{link_to('My Account',user_path)}"29 if current_user.admin30 bar << "#{link_to("Admin", :controller => 'users', :action => 'index')}"31 end32 bar << "#{link_to('Sign out', :controller => 'account', :action => 'logout')}"33 else34 bar << "#{link_to("Sign in", :controller => 'account', :action => 'login')}"35 end36 links = bar.join(" | ").to_s37 content_tag(:p,links,:class => 'welcome')38 end39 4 40 5 def menu_item(content,address) … … 46 11 bar = [] 47 12 un = "" 48 bar << menu_item("Submit a Url", root_path)49 bar << menu_item("Search Catalog", urls_path)13 bar << menu_item("Submit a Url",urls_path) 14 bar << menu_item("Search Catalog",search_path) 50 15 51 16 if logged_in? 52 un = "#{current_user.login} "17 un = "#{current_user.login} :" 53 18 bar << menu_item("My Account",user_path(current_user)) 54 19 bar << menu_item("Admin",users_path) if current_user.admin? … … 60 25 links = bar.join(" | ").to_s 61 26 62 content_tag(:p,"#{un} :#{links}",:class => 'welcome')27 content_tag(:p,"#{un} #{links}",:class => 'welcome') 63 28 end 64 29 community_hive/trunk/community_hive_web/app/helpers/users_helper.rb
r1785 r1800 17 17 18 18 19 def change_a ccess_key(user)20 msg = <<-MSG21 Are you sure you want to change the access key?\n 22 The bee will need to update the key locally before 23 it can communicate with the Hive.\n 24 Please make sure to send the new key to the Bee admin. 25 MSG 26 link_to('Change Bee Key', { :action => 'change_bee_key', :id => user }, :confirm => msg, :method => :post)19 def change_admin_privs(user) 20 msg = "Are you sure you want to change the user's admin priviledge?" 21 caption = "toggle" 22 if user.admin 23 link_to(caption, {:action => 'admin_priv', :id => user}, :confirm => msg) 24 else 25 link_to(caption, {:action => 'admin_priv', :id => user}, :confirm => msg) 26 end 27 27 end 28 28 end community_hive/trunk/community_hive_web/app/views/main/index.html.erb
r1720 r1800 3 3 Send us a Url of a site you would like to check for malicious software. 4 4 </p> 5 <%= show_message %> 6 <% form_tag '/main/create' do -%> 7 Url: <%= text_field_tag 'url', '', :size => '50' %> 8 <p style="font-size: small; color: #444; padding-left: 35px; padding-top: 5px; margin: 0;"> 9 Example: http://example.com/hello 10 </p> 11 <p> 12 CAPTCH HERE... 13 </p> 14 <%= submit_tag 'Check It' %> 15 <% end -%> 5 <% form_tag '/main/create' do -%> 6 <label>Url ( example: http://helloworld.com )</label> 7 <%= text_field_tag 'url', '', :size => '45' %> 8 <%= submit_tag 'Check It', :class => 'button'%> 16 9 10 <p> 11 CAPTCH HERE... 12 </p> 13 <% end -%> 14 community_hive/trunk/community_hive_web/app/views/statistics/index.html.erb
r1721 r1800 1 <h2> Statistics</h2>1 <h2>Numbers</h2> 2 2 3 <h3>Latest bad Urls</h3>4 3 <table class="search"> 5 4 <tbody> 6 5 <tr> 7 <td>rating</td> 8 <td>top level domain</td> 6 <td><h3>Latest Bad Urls</h3></td> 9 7 </tr> 10 8 <% for results in @latest_bad %> 11 9 <tr> 12 <td><%= status_image(results.status) %></td>13 10 <td><%= link_to results.host, :controller => 'urls', :action => 'show', :id => results %></td> 14 11 </tr> … … 16 13 </tbody> 17 14 </table> 18 19 <h3>Some numbers</h3> 20 <table> 15 <table class="search"> 21 16 <tbody> 22 17 <tr> 23 <td>Total Urls collected:</td> 24 <td><%=h @total %></td> 18 <td><h3>Total Urls collected:</h3></td> 19 <td><%=h @total %></td> 20 </tr> 21 <tr> 22 <td><h3>Current Queue Size:</h3></td> 23 <td><%=h @queue %></td> 25 24 </tr> 26 25 </tbody> 27 26 </table> 28 27 29 TODO:30 - Show Bad Urls vs. All Urls in the past 24 hours31 - Top 10 bad URL in the past 2432 - Show the number of urls processed each day for the past week33 28
