Changeset 1720

Show
Ignore:
Timestamp:
07/30/08 17:24:43 (4 months ago)
Author:
dbryson
Message:

updates…

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • community_hive/trunk/community_hive_web/app/controllers/account_controller.rb

    r1717 r1720  
    77    if logged_in? 
    88      redirect_back_or_default(:controller => '/main', :action => 'index') 
    9       flash[:notice] = "Logged in successfully" 
     9      flash[:message] = "Logged in successfully" 
    1010    else 
    11       flash[:notice] = "Bad Username or Password. Please try again." 
     11      flash[:error] = "Bad Username or Password. Please try again." 
    1212    end 
    1313  end 
     
    1616  def logout 
    1717    reset_session 
    18     flash[:notice] = "You have been logged out." 
     18    flash[:message] = "You have been logged out." 
    1919    redirect_back_or_default(:controller => '/account', :action => 'login') 
    2020  end 
  • community_hive/trunk/community_hive_web/app/controllers/urls_controller.rb

    r1719 r1720  
    11class UrlsController < ApplicationController 
    2  
     2   before_filter :login_required, :only => [:show] 
    33  def index 
    44  end 
     
    1515 
    1616  def show 
     17    @u = HistoryUrl.find(params[:id]) 
     18    @count = HistoryUrl.count(:conditions => ["url = ?",@u.url]) 
    1719  end 
    1820end 
  • community_hive/trunk/community_hive_web/app/controllers/users_controller.rb

    r1719 r1720  
    11class UsersController < ApplicationController 
    22  before_filter :login_required 
    3   before_filter :check_for_admin 
     3  before_filter :check_for_admin, :except => [:myprofile,:edit_my_profile] 
    44   
    5   verify :method => :post, :only => [ :destroy, :create, :update ], 
    6          :redirect_to => { :action => :index } 
    7    
     5     
    86  def index 
    97    @users = User.paginate(:order => 'login DESC',:page => params[:page], :per_page => 10) 
    108  end 
    119 
     10  # Show the users profile so they may edit it 
     11  def myprofile 
     12    @user = current_user 
     13  end 
     14   
    1215  def show 
    1316    @user = User.find(params[:id]) 
     
    2124    @user = User.new(params[:user]) 
    2225    if @user.save 
    23       flash[:notice] = 'User was successfully created.' 
     26      flash[:message] = 'User was successfully created.' 
    2427      redirect_to :action => 'index' 
    2528    else 
     
    3033  def edit 
    3134    @user = User.find(params[:id]) 
     35  end 
     36   
     37  def edit_my_profile 
     38    @user = current_user 
    3239  end 
    3340   
     
    4350    # destroy all heartbeats for old key 
    4451    logger.info("Changing BEE KEY") 
    45     flash[:notice] = 'Bee access key was successfully changed.' 
     52    flash[:message] = 'Bee access key was successfully changed.' 
    4653    redirect_to :action => 'show', :id => @user 
    4754  end 
     
    5057    @user = User.find(params[:id]) 
    5158    if @user.update_attributes(params[:user]) 
    52       flash[:notice] = 'User was successfully updated.' 
     59      flash[:message] = 'User was successfully updated.' 
    5360      redirect_to :action => 'show', :id => @user 
    5461    else 
  • community_hive/trunk/community_hive_web/app/helpers/application_helper.rb

    r1719 r1720  
    22module ApplicationHelper 
    33   
    4   def nav_bar(user) 
     4  def nav_bar 
    55    b = "" 
    66    b << "<li>#{link_to("Check a URL", :controller => 'main', :action => 'index')}</li>" 
     
    88    b << "<li>#{link_to("Stats", :controller => 'statistics', :action => 'index')}</li>" 
    99    b << "<li>#{link_to("About", :controller => 'about', :action => 'index')}</li>" 
    10     if user 
    11       b << "<li>#{link_to("My Account", :controller => 'myaccount', :action => 'index')}</li>" 
     10    if logged_in? 
     11      b << "<li>#{link_to("My Account", :controller => 'users', :action => 'myprofile')}</li>" 
    1212      b << "<li>#{link_to("Logout", :controller => 'account', :action => 'logout')}</li>" 
    13       if user.admin 
    14         b << "<li>#{link_to("Admin", :controller => 'accounts', :action => 'index')}</li>" 
     13      if current_user.admin 
     14        b << "<li>#{link_to("Admin", :controller => 'users', :action => 'index')}</li>" 
    1515      end 
    1616    else 
  • community_hive/trunk/community_hive_web/app/views/account/login.html.erb

    r1620 r1720  
    11<h2>Please login</h2> 
     2<%= show_message %> 
    23<% form_tag do -%> 
    34<p><label for="login">Username</label> 
  • community_hive/trunk/community_hive_web/app/views/layouts/application.html.erb

    r1717 r1720  
    1515   <div id="navbar"> 
    1616     <ul id="nav"> 
    17        <%= nav_bar(@current_user) %> 
     17       <%= nav_bar %> 
    1818     </ul> 
    1919   </div> 
  • community_hive/trunk/community_hive_web/app/views/main/index.html.erb

    r1717 r1720  
    33  Send us a Url of a site you would like to check for malicious software. 
    44</p> 
     5 <%= show_message %> 
    56<% form_tag '/main/create' do -%> 
    6   <%= show_message %> 
    77  Url: <%= text_field_tag 'url', '', :size => '50' %> 
    88<p style="font-size: small; color: #444; padding-left: 35px; padding-top: 5px; margin: 0;"> 
  • community_hive/trunk/community_hive_web/app/views/myaccount/index.html.erb

    r1620 r1720  
    4040  </tr> 
    4141</table> 
    42  
    43 < 
  • community_hive/trunk/community_hive_web/app/views/urls/search.html.erb

    r1719 r1720  
    1818<table class="search"> 
    1919 <tbody> 
     20   <tr> 
     21    <td>rating</td> 
     22    <td>top level domain</td> 
     23   </tr> 
    2024   <%= render :partial => 'results', :collection => @list %> 
    2125 </tbody> 
  • community_hive/trunk/community_hive_web/app/views/users/edit.html.erb

    r1620 r1720  
    1313  <tr> 
    1414    <td>Admin permission?:</td> 
    15     <td><%= select :user, :admin, [['True',1],['False',0] ] %></td> 
     15    <td><%= select :user, :admin, [['False',0],['True',1] ] %></td> 
    1616  </tr> 
    1717  <tr> 
     
    3131    <br/> 
    3232    <%= submit_tag 'Edit Account' %>&nbsp;|&nbsp; 
    33     <%= link_to 'Cancel', :action => 'index' %> 
     33    <%= link_to 'Cancel', :action => 'myprofile' %> 
    3434    </td> 
    3535  </tr> 
  • community_hive/trunk/community_hive_web/public/stylesheets/style.css

    r1719 r1720  
    1212    border-left: 2px solid #ccc; 
    1313    border-right: 2px solid #ccc; 
     14    border-bottom: 2px solid #ccc; 
    1415} 
    1516