Skip to content

Commit

Permalink
Changes to the species show page in connection with redmine issue #22…
Browse files Browse the repository at this point in the history
…11 and changes to the user controller and display of user link in menu in connection with redmine issue #2186.
  • Loading branch information
MarvinJ authored and gsrohde committed Jul 8, 2014
1 parent b61c4a8 commit 54b3f37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
13 changes: 8 additions & 5 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ def index
@iteration = params[:iteration][/\d+/] rescue 1
if current_user.page_access_level == 1
@users = User.sorted_order("#{sort_column('users', 'created_at')} DESC").search(params[:search]).paginate(
:page => params[:page],
:page => params[:page],
:per_page => params[:DataTables_Table_0_length]
)
else
@users = User.find(current_user.id)
@users = User.where("id = #{current_user.id}").paginate(
:page => params[:page],
:per_page => params[:DataTables_Table_0_length]
)
end

respond_to do |format|
Expand All @@ -21,7 +24,7 @@ def index
end
end

def show
def show
if current_user.page_access_level == 1
user_id = params[:id]
else
Expand All @@ -33,15 +36,15 @@ def show
def new
@user = User.new
end

def create
logout_keeping_session!
@user = User.new(params[:user])
@user.access_level = 3
@user.page_access_level = 4
if Rails.env == "test"
success = @user && @user.save
else
else
success = verify_recaptcha(:model => @user, :message => "Please re-enter the words from the image again.") && @user && @user.save
end
page_access_level = ["", "Administrator", "Manager", "Creator", "Viewer"]
Expand Down
2 changes: 0 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@
<li><%= link_to "Species", species_index_path %></li>
<li><%= link_to "Traits", traits_path %></li>
<li><%= link_to "Treatments", treatments_path %></li>
<% if current_user != nil && current_user.page_access_level <= 1 %>
<li><%= link_to "Users", users_path %></li>
<% end %>
<li><%= link_to "Variables", variables_path %></li>
<li><%= link_to "Yields", yields_path %></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions app/views/species/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<dl class = "dl-horizontal">
<dt>Plant:</dt>
<dd><%= @specie.AcceptedSymbol %></dd>
<dt>Spcd:</dt>
<dt>USDA Species Symbol:</dt>
<dd><%= @specie.spcd %></dd>
<dt>Genus:</dt>
<dd><%= @specie.genus %></dd>
<dt>Species:</dt>
<dd><%= @specie.species %></dd>
<dt>Scientificname:</dt>
<dt>Scientific Name:</dt>
<dd><%= @specie.scientificname %></dd>
<dt>Commonname:</dt>
<dt>Common Name:</dt>
<dd><%= @specie.commonname %></dd>

</dl>
Expand Down

0 comments on commit 54b3f37

Please sign in to comment.