diff --git a/.ruby-version b/.ruby-version index e1b9401f..c506e4ef 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0-p195 +ruby-2.0.0-p353 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 352b92d3..00000000 --- a/.rvmrc +++ /dev/null @@ -1,2 +0,0 @@ -rvm use --create 2.0.0-p195@amahi - diff --git a/Gemfile b/Gemfile index b894a6b9..804b67dc 100644 --- a/Gemfile +++ b/Gemfile @@ -1,23 +1,26 @@ source 'https://rubygems.org' -gem 'rails', '3.2.17' +gem "rails", '~>4.1.1' gem 'mysql2' gem "yettings" -group :assets do - gem 'sass-rails' - gem 'coffee-rails' +gem 'sass-rails' , '~>4.0.3' +gem 'coffee-rails' - gem 'therubyracer' +gem 'therubyracer' - gem 'uglifier' -end +gem 'uglifier' + +gem "activeresource", require: "active_resource" +gem 'protected_attributes' +gem 'actionpack-action_caching' +gem 'rails-observers' gem 'jbuilder' gem 'ya2yaml' -gem 'themes_for_rails' +gem 'themes_for_rails', :git => "https://github.com/amahi/themes_for_rails.git" gem 'jquery-rails' gem 'jquery-ui-rails' @@ -43,7 +46,7 @@ group :development do # FIXME: for Fedora only if ((open('/etc/issue').grep(/fedora/i).length > 0) rescue false) - gem 'minitest' + gem "minitest" end end diff --git a/Gemfile.lock b/Gemfile.lock index fcff153c..bbb5785a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,42 +1,54 @@ +GIT + remote: https://github.com/amahi/themes_for_rails.git + revision: e0f2e834ce27f19b287e964f18f027a9b4f172bb + specs: + themes_for_rails (0.5.1) + rails (>= 3.0.0) + GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.17) - actionpack (= 3.2.17) + actionmailer (4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) mail (~> 2.5.4) - actionpack (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - builder (~> 3.0.0) + actionpack (4.1.1) + actionview (= 4.1.1) + activesupport (= 4.1.1) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionpack-action_caching (1.1.1) + actionpack (>= 4.0.0, < 5.0) + actionview (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.17) - activesupport (= 3.2.17) - builder (~> 3.0.0) - activerecord (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - activesupport (3.2.17) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) + activemodel (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) + activerecord (4.1.1) + activemodel (= 4.1.1) + activesupport (= 4.1.1) + arel (~> 5.0.0) + activeresource (4.0.0) + activemodel (~> 4.0) + activesupport (~> 4.0) + rails-observers (~> 0.1.1) + activesupport (4.1.1) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) addressable (2.3.6) - arel (3.0.3) - authlogic (3.4.1) + arel (5.0.1.20140414130214) + authlogic (3.4.2) activerecord (>= 3.2) activesupport (>= 3.2) - request_store (~> 1.0.5) + request_store (~> 1.0) bcrypt (3.1.7) - builder (3.0.4) - capybara (2.2.1) + builder (3.2.2) + capybara (2.3.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -46,19 +58,19 @@ GEM capybara (>= 1.0, < 3) launchy cliver (0.3.2) - coffee-rails (3.2.2) + coffee-rails (4.0.1) coffee-script (>= 2.2.0) - railties (~> 3.2.0) + railties (>= 4.0.0, < 5.0) coffee-script (2.2.0) coffee-script-source execjs coffee-script-source (1.7.0) daemons (1.1.9) diff-lcs (1.2.5) - docile (1.1.3) + docile (1.1.5) erubis (2.7.0) eventmachine (1.0.3) - execjs (2.0.2) + execjs (2.2.0) factory_girl (4.4.0) activesupport (>= 3.0.0) factory_girl_rails (4.4.1) @@ -70,11 +82,10 @@ GEM rake hike (1.2.3) i18n (0.6.9) - jbuilder (2.0.6) + jbuilder (2.1.1) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - journey (1.0.4) - jquery-rails (3.1.0) + jquery-rails (3.1.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) jquery-ui-rails (4.2.1) @@ -88,67 +99,70 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_portile (0.5.3) - minitest (5.3.3) - multi_json (1.9.2) - mysql2 (0.3.15) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) - poltergeist (1.5.0) + mini_portile (0.6.0) + minitest (5.3.5) + multi_json (1.10.1) + mysql2 (0.3.16) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) + poltergeist (1.5.1) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - polyglot (0.3.4) + polyglot (0.3.5) + protected_attributes (1.0.8) + activemodel (>= 4.0.1, < 5.0) psych (2.0.5) - quiet_assets (1.0.2) + quiet_assets (1.0.3) railties (>= 3.1, < 5.0) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.4) - rack + rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) - rails (3.2.17) - actionmailer (= 3.2.17) - actionpack (= 3.2.17) - activerecord (= 3.2.17) - activeresource (= 3.2.17) - activesupport (= 3.2.17) - bundler (~> 1.0) - railties (= 3.2.17) - railties (3.2.17) - actionpack (= 3.2.17) - activesupport (= 3.2.17) - rack-ssl (~> 1.3.2) + rails (4.1.1) + actionmailer (= 4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) + activemodel (= 4.1.1) + activerecord (= 4.1.1) + activesupport (= 4.1.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.1) + sprockets-rails (~> 2.0) + rails-observers (0.1.2) + activemodel (~> 4.0) + railties (4.1.1) + actionpack (= 4.1.1) + activesupport (= 4.1.1) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) + thor (>= 0.18.1, < 2.0) raindrops (0.13.0) - rake (10.3.1) + rake (10.3.2) rb-readline (0.5.1) - rdoc (3.12.2) - json (~> 1.4) ref (1.0.5) - request_store (1.0.5) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - rspec-rails (2.14.2) + request_store (1.0.6) + rspec-core (3.0.2) + rspec-support (~> 3.0.0) + rspec-expectations (3.0.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.0.0) + rspec-mocks (3.0.2) + rspec-support (~> 3.0.0) + rspec-rails (3.0.1) actionpack (>= 3.0) - activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - sass (3.3.6) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-support (~> 3.0.0) + rspec-support (3.0.2) + sass (3.2.19) + sass-rails (4.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) scrypt (1.2.1) ffi-compiler (>= 0.0.2) rake @@ -160,15 +174,17 @@ GEM slim (2.0.2) temple (~> 0.6.6) tilt (>= 1.3.3, < 2.1) - sprockets (2.2.2) + sprockets (2.11.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.1.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) sqlite3 (1.3.9) temple (0.6.7) - themes_for_rails (0.5.1) - rails (>= 3.0.0) therubyracer (0.12.1) libv8 (~> 3.16.14.0) ref @@ -177,15 +193,17 @@ GEM eventmachine (>= 1.0.0) rack (>= 1.0.0) thor (0.19.1) + thread_safe (0.3.4) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) - uglifier (2.5.0) + tzinfo (1.2.1) + thread_safe (~> 0.1) + uglifier (2.5.1) execjs (>= 0.3.0) json (>= 1.8.0) - unicorn (4.8.2) + unicorn (4.8.3) kgio (~> 2.6) rack raindrops (~> 0.7) @@ -199,6 +217,8 @@ PLATFORMS ruby DEPENDENCIES + actionpack-action_caching + activeresource authlogic bcrypt capybara @@ -211,17 +231,19 @@ DEPENDENCIES minitest mysql2 poltergeist + protected_attributes psych quiet_assets - rails (= 3.2.17) + rails (~> 4.1.1) + rails-observers rb-readline rspec-rails - sass-rails + sass-rails (~> 4.0.3) scrypt simplecov slim sqlite3 - themes_for_rails + themes_for_rails! therubyracer thin thor diff --git a/Makefile b/Makefile index 1f7c2f8d..fec15e37 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ bundle: - bundle install --without test --path vendor/bundle --binstubs bin/ --deployment - (cd vendor/bundle/ruby/gems/; find . -type f -exec grep -l '/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby' {} \; | xargs sed -i -e 's|/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby|/usr/bin/ruby|') || true + /usr/bin/bundle install --without test --path vendor/bundle --binstubs bin/ --deployment + (cd vendor/bundle/ruby/ && find . -type f -exec grep -l '/usr/bin/ruby' {} \; | xargs sed -i -e 's|/usr/bin/ruby|/usr/bin/ruby|') || true + # clean up things that are not needed at run time + (cd vendor/bundle/ruby/ && rm -rf cache) || true + (cd vendor/bundle/ruby/gems && rm -rf rails-*/guides */spec */doc */doc-api) || true + (cd vendor/bundle/ruby/gems && rm -rf */test */tests) || true + (cd vendor/bundle/ruby/ && find . \( -name '*.[coa]' -or -name '*.cc' -or -name '*.md' -or -name '.git' \) -exec rm -rf {} \;) || true distclean: clean rm -rf vendor/bundle diff --git a/app/assets/images/logo16x16.png b/app/assets/images/logo16x16.png index a81c1b0b..a46636a6 100644 Binary files a/app/assets/images/logo16x16.png and b/app/assets/images/logo16x16.png differ diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png deleted file mode 100644 index d5edc04e..00000000 Binary files a/app/assets/images/rails.png and /dev/null differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 82d50edc..0ba021c5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,5 +13,5 @@ //= require lib/application //= require lib/templates //= require lib/smart-links - +//= require lib/debug //= require spinner diff --git a/app/assets/javascripts/lib/debug.js.coffee b/app/assets/javascripts/lib/debug.js.coffee new file mode 100644 index 00000000..bf13fa42 --- /dev/null +++ b/app/assets/javascripts/lib/debug.js.coffee @@ -0,0 +1,24 @@ +# Amahi Home Server +# Copyright (C) 2007-2013 Amahi +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License v3 +# (29 June 2007), as published in the COPYING file. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# file COPYING for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Amahi +# team at http://www.amahi.org/ under "Contact Us." + +# Debug JS functionality + + +$(document).on "ajax:success", ".debug-form", (event, results) -> + if results.status is "ok" + $('#debug-submit-form').html("
Error Log Succesfully Submitted
") + else + $('#debug-submit-form').html("Debug report failed. Please do try again later.
") \ No newline at end of file diff --git a/app/assets/stylesheets/login.css.scss b/app/assets/stylesheets/login.css.scss index 71475bde..1039576a 100644 --- a/app/assets/stylesheets/login.css.scss +++ b/app/assets/stylesheets/login.css.scss @@ -57,7 +57,7 @@ a {text-decoration: none;} margin: 20px auto 7em auto; } -.message-error { +.alert-danger{ margin: 0 0 16px 8px; padding: 12px; border: 1px solid #C00000; @@ -71,7 +71,7 @@ a {text-decoration: none;} background-color: #e0ffda; } -.message-notice { +.alert-info { margin: 0 0 16px 8px; padding: 12px; border: 1px solid #FAB762; diff --git a/app/assets/themes/default/stylesheets/style.css.scss b/app/assets/themes/default/stylesheets/style.css.scss index 5e5590e8..b9123747 100644 --- a/app/assets/themes/default/stylesheets/style.css.scss +++ b/app/assets/themes/default/stylesheets/style.css.scss @@ -1558,3 +1558,31 @@ textarea {border: 1px solid #ccc;} .hide { display: none; } + +//Markup for alert boxes +.alert { +padding: 15px; +margin-bottom: 20px; +border: 1px solid transparent; +border-radius: 4px; +} +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +//Debug Tab Design +.debug-form{ + margin-top:10px !important; + margin-left: 20px !important; +} \ No newline at end of file diff --git a/app/controllers/aliases_controller.rb b/app/controllers/aliases_controller.rb index 74867e81..e7955d84 100644 --- a/app/controllers/aliases_controller.rb +++ b/app/controllers/aliases_controller.rb @@ -18,8 +18,8 @@ class AliasesController < ApplicationController before_filter :admin_required - VALID_NAME = Regexp.new "^[A-Za-z0-9\-]+$" - VALID_ADDRESS = Regexp.new '^(|\d(\d?\d?)|\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?))$' + VALID_NAME = Regexp.new "\A[A-Za-z0-9\-]+\z" + VALID_ADDRESS = Regexp.new '\A(|\d(\d?\d?)|\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?))\z' def initialize @page_title = 'DNS Aliases' @@ -160,7 +160,7 @@ def new_alias_check render :partial => 'aliases/name_bad' return end - a = DnsAlias.find_by_alias(n) + a = DnsAlias.where(:alias=>n).first if a.nil? # no such alias, ok to create it @name = n @@ -195,7 +195,7 @@ def valid_address?(addr) # NOTE: do not allow aliases to the hda as a blank address return false if addr.blank? return false unless (addr =~ VALID_ADDRESS) - if addr =~ Regexp.new('^(\d+)\.(\d+)\.(\d+)\.(\d+)$') + if addr =~ Regexp.new('\A(\d+)\.(\d+)\.(\d+)\.(\d+)\z') [$1, $2, $3, $4].each { |ip| return false if ip.to_i > 254 } return true end @@ -203,11 +203,11 @@ def valid_address?(addr) end def is_address_full?(addr) - (addr =~ Regexp.new('^(\d+)\.(\d+)\.(\d+)\.(\d+)$')) ? true : false + (addr =~ Regexp.new('\A(\d+)\.(\d+)\.(\d+)\.(\d+)\z')) ? true : false end def valid_short_address?(addr) - if addr =~ Regexp.new('^(\d+)$') + if addr =~ Regexp.new('\A(\d+)\z') v = addr.to_i return true unless v < 0 or v > 254 end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e4429191..9a329c6f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,17 +37,17 @@ def before_filter_hook set_direction check_for_amahi_app prepare_theme - adv = Setting.find_by_name('advanced') + adv = Setting.where(:name=>'advanced').first @advanced = adv && adv.value == '1' end def check_for_amahi_app server = request.env['SERVER_NAME'] dom = Setting.get_by_name('domain') - if server && server != 'hda' && server =~ /^(.*)\.#{dom}$/ + if server && server != 'hda' && server =~ /\A(.*)\.#{dom}\z/ server = $1 end - if server && server != 'hda' && DnsAlias.find_by_name(server) + if server && server != 'hda' && DnsAlias.where(:name=>server).first redirect_to "http://hda/hda_app_#{server}" end end @@ -75,8 +75,8 @@ def setup_router rd = RouterDriver.current_router = (r ? r.value : "") # return the class proper if valid @router = Kernel.const_get(rd) unless rd.blank? - u = Setting.network.find_by_name('router_username') - p = Setting.network.find_by_name('router_password') + u = Setting.network.where(:name=>'router_username').first + p = Setting.network.where(:name=>'router_password').first RouterDriver.set_auth(unobfuscate(u.value), unobfuscate(p.value)) if p and u and p.value and u.value rescue # shhh. comment out the rescue for debugging @@ -165,7 +165,7 @@ def current_user def login_required unless current_user store_location - flash[:notice] = I18n.t('must_be_logged_in') + flash[:info] = I18n.t('must_be_logged_in') redirect_to new_user_session_path return false end @@ -181,7 +181,7 @@ def admin_required return false if login_required == false unless current_user.admin? store_location - flash[:notice] = t('must_be_admin') + flash[:info] = t('must_be_admin') redirect_to new_user_session_url return false end diff --git a/app/controllers/calendar_controller.rb b/app/controllers/calendar_controller.rb index b7163282..c1cf6b44 100644 --- a/app/controllers/calendar_controller.rb +++ b/app/controllers/calendar_controller.rb @@ -36,7 +36,7 @@ def remove FileUtils.rm_rf(".DAV/" + calname + ".dir") @calendars = Dir["*.ics"] end - @has_ical = App.find_by_name 'iCalendar' != nil + @has_ical = App.where(:name => 'iCalendar').first != nil render :partial => 'calendar/calendar', :collection => @calendars, :locals => { :has_ical => @has_ical } end @@ -52,7 +52,7 @@ def new end @calendars = Dir["*.ics"] end - @has_ical = App.find_by_name 'iCalendar' != nil + @has_ical = App.where(:name=>'iCalendar').first != nil render :partial => 'calendar/calendar', :collection => @calendars, :locals => { :has_ical => @has_ical } end diff --git a/app/controllers/debug_controller.rb b/app/controllers/debug_controller.rb new file mode 100644 index 00000000..8b68821f --- /dev/null +++ b/app/controllers/debug_controller.rb @@ -0,0 +1,51 @@ +# Amahi Home Server +# Copyright (C) 2007-2013 Amahi +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License v3 +# (29 June 2007), as published in the COPYING file. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# file COPYING for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Amahi +# team at http://www.amahi.org/ under "Contact Us." + +class DebugController < ApplicationController + + before_filter :admin_required + layout 'debug' + + def index + @page_title = t('debug') + end + + def logs + @page_title = t('debug') + end + + def system + @page_title = t('debug') + end + + + def submit + AmahiApi.api_key = Setting.get "api-key" + report = SystemUtils.run 'tail -200 /var/hda/platform/html/log/production.log' + er = AmahiApi::ErrorReport.new(:report => report, :comments => params[:comments], :subject => params[:subject]) + begin + if er.save + render :json =>{:status=>'ok'} + else + render :json =>{:status=>'failed',:errors=> er.errors} + end + rescue + render :json =>{:status=>'failed',:errors=> er.errors} + end + end + + +end diff --git a/app/controllers/front_controller.rb b/app/controllers/front_controller.rb index 5f1264cd..8113495b 100644 --- a/app/controllers/front_controller.rb +++ b/app/controllers/front_controller.rb @@ -4,12 +4,12 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License v3 # (29 June 2007), as published in the COPYING file. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # file COPYING for more details. -# +# # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Amahi # team at http://www.amahi.org/ under "Contact Us." @@ -24,5 +24,4 @@ def index @apps = App.in_dashboard @news = AmahiNews.top() end - end diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 01d56dc1..84ed22e1 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -17,8 +17,8 @@ class HostsController < ApplicationController before_filter :admin_required - VALID_NAME = Regexp.new "^[A-Za-z][A-Za-z0-9\-]+$" - VALID_ADDRESS = Regexp.new '^(|\d(\d?\d?)|\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?))$' + VALID_NAME = Regexp.new "\A[A-Za-z][A-Za-z0-9\-]+\z" + VALID_ADDRESS = Regexp.new '\A(|\d(\d?\d?)|\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?)\.\d(\d?\d?))\z' MAC_P = '(\d|[A-Fa-f])(\d|[A-Fa-f])' # This is the range at which DHCP starts. Strictly below is valid @@ -122,7 +122,7 @@ def update_address render :text => a.address return end - h = Host.find_by_address addr + h = Host.where(:address=>addr).first if h.nil? # no such address, ok to use it a.address = addr @@ -140,7 +140,7 @@ def update_mac render :text => a.mac return end - h = Host.find_by_mac mac + h = Host.where(:mac=>mac).first if h.nil? # no such address, ok to use it a.mac = mac @@ -172,7 +172,7 @@ def new_host_check render :partial => 'hosts/name_bad' return end - a = Host.find_by_host(n) + a = Host.where(:host=>n).first if a.nil? # no such alias, ok to create it @name = n @@ -190,7 +190,7 @@ def new_address_check render :partial => 'hosts/address_bad' return end - a = Host.find_by_address(n) + a = Host.where(:address=>n).first if a.nil? # no such address, ok to create it @name = n @@ -208,7 +208,7 @@ def new_mac_check render :partial => 'hosts/mac_bad' return end - a = Host.find_by_mac(n) + a = Host.where(:mac=>n).first if a.nil? # no such mac, ok to create it @name = n @@ -242,7 +242,7 @@ def valid_name?(nm) end def valid_short_address?(addr) - if addr =~ Regexp.new('^(\d+)$') + if addr =~ Regexp.new('\A(\d+)\z') v = addr.to_i return true if v > 0 and v < VALID_DHCP_ADDRESS_RANGE end diff --git a/app/controllers/share_controller.rb b/app/controllers/share_controller.rb index 0f792821..45e1bd78 100644 --- a/app/controllers/share_controller.rb +++ b/app/controllers/share_controller.rb @@ -17,7 +17,7 @@ class ShareController < ApplicationController before_filter :admin_required - VALID_NAME = Regexp.new "^\\w[\\w ]+$" + VALID_NAME = Regexp.new "\A\\w[\\w ]+\z" # Disk Pool minimum free: default og 10GB, but for root, # 20GB. so that when all drives are full, / should still have 10GB free. DP_MIN_FREE_DEFAULT = 10 @@ -97,7 +97,7 @@ def new_share_name_check render :partial => 'share/name_invalid' return false end - share = Share.find_by_name(sn) + share = Share.where(:name=>sn).first if share render :partial => 'share/name_not_available' return false @@ -118,7 +118,7 @@ def new_share_path_check render :partial => 'share/path_invalid' return false end - share = Share.find_by_path(sp) + share = Share.where(:path=>sp).first if share render :partial => 'share/path_not_available' return false @@ -296,7 +296,7 @@ def update_disk_pool_copies def toggle_disk_pool_partition path = params[:path] - part = DiskPoolPartition.find_by_path(path) + part = DiskPoolPartition.where(:path=>path).first if part # was enabled - disable it by deleting it # FIXME - see http://bugs.amahi.org/issues/show/510 @@ -318,7 +318,7 @@ def toggle_disk_pool_partition def is_valid_domain_name(domain) return false if domain.size > 15 || domain.size < 1 - return false unless domain =~ /^[A-z][A-z_0-9]*$/ + return false unless domain =~ /\A[A-z][A-z_0-9]*\z/ true end diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index 921be70b..c475a09c 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -4,12 +4,12 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License v3 # (29 June 2007), as published in the COPYING file. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # file COPYING for more details. -# +# # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Amahi # team at http://www.amahi.org/ under "Contact Us." @@ -34,7 +34,7 @@ def start else # initial system initialization @user = User.new - flash[:notice] = t("amahi_initialization") + flash[:info] = t("amahi_initialization") @title = t("amahi_initialization") end end @@ -45,9 +45,10 @@ def create remember_me = params[:remember_me] @user_session = UserSession.new(:login => username, :password => password, :remember_me => remember_me) if @user_session.save + flash[:success] = t 'logged_in_successfully' redirect_to root_url else - flash[:error] = t 'not_a_valid_user_or_password' + flash[:danger] = t 'not_a_valid_user_or_password' render :action => 'new' end end @@ -57,7 +58,7 @@ def destroy @user_session = UserSession.find @user_session.destroy # FIXME-translate - flash[:notice] = t('you_have_been_logged_out') + flash[:info] = t('you_have_been_logged_out') redirect_to root_path end @@ -67,7 +68,7 @@ def initialize_system pwd = params[:password] conf = params[:password_confirmation] unless valid_admin_password?(pwd, conf) - flash[:error] = t 'not_a_valid_user_or_password' + flash[:danger] = t 'not_a_valid_user_or_password' @user = User.new sleep 1 render :action => 'start' @@ -80,13 +81,13 @@ def initialize_system # FIXME-cpg: very hackish constant for regular uid (1000) unless name and uid and uid >= 1000 # not a system user. should we create one? - flash[:error] = t 'not_a_valid_user_or_password' + flash[:danger] = t 'not_a_valid_user_or_password' @user = User.new render :action => 'start' return end # the user exists in the system .. does it exist in the database? - u = User.find_by_login(systemusername) + u = User.where(:login=>systemusername).first if u @user = u else @@ -102,7 +103,7 @@ def initialize_system initialize_default_settings redirect_to root_url else - flash[:error] = t 'not_a_valid_user_or_password' + flash[:danger] = t 'not_a_valid_user_or_password' render :action => 'start' end end diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb index c52eb534..9b3f1887 100644 --- a/app/helpers/tabs_helper.rb +++ b/app/helpers/tabs_helper.rb @@ -17,13 +17,22 @@ module TabsHelper def tab_class(tab) - klass = params[:controller] == tab.id ? 'active' : '' + if params[:controller] == tab.id + klass = 'active' + else + subtab = Tab.find(params[:controller]) + if subtab==nil + if Tab.ischild(params[:controller],tab) + klass = 'active' + end + end + end klass += " empty" unless tab.subtabs? klass end - def subtab_class(action = nil) - params[:action] == action ? 'active' : '' + def subtab_class(action = nil, tab_id) + ((action == params[:action] && params[:controller] == tab_id) or (action == params[:controller] && Tab.find(params[:controller])==nil) ) ? 'active' : '' end def nav_class(tabs) @@ -38,7 +47,7 @@ def debug_tab? end def advanced? - (s = Setting.find_by_name 'advanced') && s.set? + (s = Setting.where(:name=>'advanced').first) && s.set? end def debug? diff --git a/app/models/app.rb b/app/models/app.rb index 2c754e47..059adb3c 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -41,9 +41,9 @@ class App < ActiveRecord::Base has_many :children, :class_name => "AppDependency", :foreign_key => 'dependency_id' has_many :dependencies, :through => :app_dependencies - scope :installed, where(:installed => true) - scope :in_dashboard, where(:show_in_dashboard => true).installed - scope :latest_first, :order => 'updated_at desc' + scope :installed, ->{where(:installed => true)} + scope :in_dashboard,-> {where(:show_in_dashboard => true).installed} + scope :latest_first, ->{order('updated_at desc')} before_destroy :before_destroy_hook @@ -111,7 +111,7 @@ def self.available AmahiApi::api_key = Setting.value_by_name("api-key") begin AmahiApi::App.find(:all).map do |online_app| - App.find_by_identifier(online_app.id) ? nil : App.new(online_app.id, online_app) + App.where(:identifier=>online_app.id).first ? nil : App.new(online_app.id, online_app) end.compact rescue [] @@ -157,14 +157,14 @@ def install_status end def self.installation_status(identifier) - status = Setting.find_by_kind_and_name(identifier, 'install_status') + status = Setting.where(:kind=>identifier,:name=> 'install_status').first return 0 unless status status.value.to_i end def install_status=(value) # create it dynamically if it does not exist - status = Setting.find_or_create_by(self.identifier, 'install_status', value) + status = Setting.where(:kind=>self.identifier, :name=> 'install_status').first_or_create if value.nil? status && status.destroy return nil @@ -213,7 +213,7 @@ def install_bg self.create_db(:name => installer.database) if installer.database && !installer.database.blank? # if it has a share, create it and install it if installer.share - sh = Share.find_by_name installer.share + sh = Share.where(:name=>installer.share).first if sh # FIXME: autohook to it. this is for legacy shares. not needed in new installs self.share = sh @@ -376,7 +376,7 @@ def install_app_deps(installer) return [] if deps.nil? or deps.blank? deps.strip! deps.split(/[, ]+/).map do |identifier| - a = App.find_by_identifier identifier + a = App.where(:identifier=>identifier).first unless a a = App.new identifier a.install_bg @@ -469,7 +469,7 @@ def webapp_name(name) i = 0 add = "" begin - wa = Webapp.find_by_name(name + add) + wa = Webapp.where(:name=>(name + add)).first return (name+add) if wa.nil? raise "cannot find a suitable webapp name. giving up at #{name+add}." if i > 29 i += 1 diff --git a/app/models/db.rb b/app/models/db.rb index f25afec5..2623cd34 100644 --- a/app/models/db.rb +++ b/app/models/db.rb @@ -4,12 +4,12 @@ # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License v3 # (29 June 2007), as published in the COPYING file. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # file COPYING for more details. -# +# # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Amahi # team at http://www.amahi.org/ under "Contact Us." @@ -40,7 +40,7 @@ def hostname private def after_create_hook - c = connection + c = self.class.connection password = name user = name host = 'localhost' @@ -58,7 +58,7 @@ def after_destroy_hook Dir.chdir(DB_BACKUPS_DIR) do system("ln -sf #{filename} latest-#{name}.bz2") end - c = connection + c = self.class.connection host = 'localhost' c.execute "drop user '#{user}'@'#{host}';" c.execute "drop database if exists `#{name}`;" diff --git a/app/models/dns_alias.rb b/app/models/dns_alias.rb index 222af9b2..d30955af 100644 --- a/app/models/dns_alias.rb +++ b/app/models/dns_alias.rb @@ -20,7 +20,7 @@ class DnsAlias < ActiveRecord::Base after_destroy :restart after_save :restart - scope :user_visible, where(["address != ?", '']) + scope :user_visible,->{where(["address != ?", ''])} attr_accessible :name, :address diff --git a/app/models/plugin.rb b/app/models/plugin.rb index 42d448d1..dc1b5c5f 100644 --- a/app/models/plugin.rb +++ b/app/models/plugin.rb @@ -52,7 +52,12 @@ def install(installer, source) # uninstall when the object is destroyed def before_destroy - location = File.join(Rails.root, "plugins", "#{1000+id}-#{path}") + base = File.basename path + location = File.join(Rails.root, "plugins", "#{1000+id}-#{base}") + array = [] + array <<"#{location}/db/migrate" + puts "Reverting the changes to the database made by the plugin" + ActiveRecord::Migrator.down(array,nil) FileUtils.rm_rf location # restart the rails stack -- FIXME: this is too much a restart would be best c = Command.new "touch /var/hda/platform/html/tmp/restart.txt" @@ -75,6 +80,10 @@ def dir2plugin(source, config) FileUtils.rm_rf destination FileUtils.mv source, destination # FIXME: eventually we need to do migrations, probably here + array = [] + array <<"#{destination}/db/migrate" + puts "Migrating database of the plugin, if applicable" + ActiveRecord::Migrator.up(array, nil) # restart the rails stack -- FIXME: this is too much a restart would be best c = Command.new "touch /var/hda/platform/html/tmp/restart.txt" c.execute diff --git a/app/models/setting.rb b/app/models/setting.rb index 3df8ac82..dc68cbe0 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -20,16 +20,16 @@ class Setting < ActiveRecord::Base attr_accessible :name, :value, :kind - scope :by_name, lambda{|name| where(:name => name)} - scope :by_kind, lambda{|kind| where(:kind => kind)} + scope :by_name, lambda{|name| where(:name => name)} + scope :by_kind, lambda{|kind| where(:kind => kind)} - scope :general, by_kind(GENERAL) - scope :network, by_kind(NETWORK) - scope :shares, by_kind(SHARES) + scope :general, ->{by_kind(GENERAL)} + scope :network, ->{by_kind(NETWORK)} + scope :shares, ->{by_kind(SHARES)} validates :value, :length => { :maximum => 15 }, - :format => { :with => /^[a-zA-Z][a-zA-Z0-9]{0,14}$/ }, + :format => { :with => /\A[a-zA-Z][a-zA-Z0-9]{0,14}\z/ }, :if => Proc.new { |x| x.kind.eql?(Setting::GENERAL) && x.name.eql?('workgroup') }, :on => :update @@ -49,7 +49,7 @@ def get(name) end def set(name, value, kind=GENERAL) - self.find_or_create_by_name(:name => name).update_attributes(value: value, kind: kind) + self.where(:name => name).first_or_create.update_attributes(value: value, kind: kind) end def get_kind(kind, name) diff --git a/app/models/share.rb b/app/models/share.rb index a0e562d6..94c2647f 100644 --- a/app/models/share.rb +++ b/app/models/share.rb @@ -26,7 +26,7 @@ class Share < ActiveRecord::Base DEFAULT_SHARES = [ "Books", "Pictures", "Movies", "Videos", "Music", "Docs", "Public" ].each {|s| I18n.t s } PDC_SETTINGS = "/var/hda/domain-settings" - default_scope order("name") + default_scope {order("name")} # scope :in_disk_pool, where([ "disk_pool_copies > ?", 0]) has_many :cap_accesses, :dependent => :destroy @@ -43,7 +43,7 @@ class Share < ActiveRecord::Base attr_accessible :name, :path, :rdonly, :visible, :tags, :extras validates :name, :presence => true, - :format => { :with => /^\w[\w ]+$/ }, + :format => { :with => /\A\w[\w ]+\z/ }, :length => { :maximum => 32 }, :uniqueness => { :case_sensitive => false } diff --git a/app/models/theme.rb b/app/models/theme.rb index cc139c03..6ee100f3 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -24,7 +24,7 @@ def self.available tl = all Dir.chdir(File.join(Rails.root, THEME_ROOT)) do Dir.glob("*").sort.each do |theme_dir| - next if find_by_css theme_dir + next if where(:css=>theme_dir).first theme_init_file = File.join(theme_dir, "init.rb") if File.exist? theme_init_file load theme_init_file diff --git a/app/models/user.rb b/app/models/user.rb index 06dc68da..e752d623 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,7 +19,7 @@ class User < ActiveRecord::Base - scope :admins, where(:admin => true) + scope :admins, ->{ where(:admin => true)} begin acts_as_authentic do |c| @@ -37,7 +37,7 @@ class User < ActiveRecord::Base attr_accessible :login, :name, :password, :password_confirmation, :admin validates :login, :presence => true, - :format => { :with => /^[A-Za-z][A-Za-z0-9]+$/ }, + :format => { :with => /\A[A-Za-z][A-Za-z0-9]+\z/ }, :length => { :in => 3..32 }, :uniqueness => { :case_sensitive => false }, :user_not_exist_in_system => {:message => 'already exists in system', :on => :create} @@ -71,7 +71,7 @@ def system_all_new_users res = [] Dir.chdir("/home") do Dir.glob("*").sort.reverse.each do |login| - unless User.find_by_login login + unless User.where(:login=> login).first name, uid = system_find_name_by_username login # FIXME-cpg: Fedora specific constant 500 here res << { :login => login, :name => name } unless name.nil? or name.blank? or uid < 500 diff --git a/app/models/webapp.rb b/app/models/webapp.rb index 958c8923..d8683193 100644 --- a/app/models/webapp.rb +++ b/app/models/webapp.rb @@ -97,13 +97,14 @@ def conf_file else # generic f = File.open(BASE % "generic") end - server_aliases = self.aliases.split(/[, ]+/).select{ |s| ! (s.empty? || DnsAlias.find_by_alias(s)) } + server_aliases = self.aliases.split(/[, ]+/).select{ |s| ! (s.empty? || DnsAlias.where(:alias=>s).first) } server_aliases += self.webapp_aliases.map{|wa| wa.name} aliases = server_aliases.count > 0 ? ("ServerAlias " + server_aliases.join(" ")) : "" conf = f.readlines.join conf = conf.gsub(/HDA_APP_NAME/, name) conf = conf.gsub(/APP_ROOT_DIR/, path) conf = conf.gsub(/HDA_DOMAIN/, domain) unless domain.empty? + conf = conf.gsub(/HDA_AUTHFILE/, "#{path}/htpasswd") conf = conf.gsub(/HDA_ACCESS/, login_required ? access_conf : '') conf = conf.gsub(/APP_ALIASES/, aliases || '') begin diff --git a/app/models/webapp_alias.rb b/app/models/webapp_alias.rb index e3a11feb..a149ee4c 100644 --- a/app/models/webapp_alias.rb +++ b/app/models/webapp_alias.rb @@ -20,12 +20,12 @@ class WebappAlias < ActiveRecord::Base after_save :save_webapp after_destroy :save_webapp - + attr_accessible :name, :webapp_id validates :name, :presence => true, :uniqueness => true, :length => { :within => 1..254 }, - :format => { :with => /^[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*){0,5}$/i } + :format => { :with => /\A[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*){0,5}\z/i } def to_s name diff --git a/app/views/aliases/_new.html.erb b/app/views/aliases/_new.html.erb index fd3838ea..409fc575 100644 --- a/app/views/aliases/_new.html.erb +++ b/app/views/aliases/_new.html.erb @@ -1,6 +1,6 @@- <%= link_to_function(h(name), '') %> + <%= link_to(h(name), '') %> | <%= h(addr) %> diff --git a/app/views/aliases/_step1.html.erb b/app/views/aliases/_step1.html.erb index 29a605c5..4156dc52 100644 --- a/app/views/aliases/_step1.html.erb +++ b/app/views/aliases/_step1.html.erb @@ -29,7 +29,7 @@ | |||||||||||||||
- <%= link_to_function t('cancel'), update_page { |page|
+ <%= link_to t('cancel'), update_page { |page|
page.hide 'new-alias-step1'
page.show 'new-alias-to-step1'
page[:alias_alias].value = ""
diff --git a/app/views/debug/_app_logs.rhtml b/app/views/debug/_app_logs.rhtml
deleted file mode 100644
index 6b2a3411..00000000
--- a/app/views/debug/_app_logs.rhtml
+++ /dev/null
@@ -1,51 +0,0 @@
-<% message_string = "\n\nExplain the sequence of events leading to the error\nin as much detail as you can.\n\nThe more *concrete detail* you can add,\nthe higher chances we fix the problem quickly!\n\nClick here to continue ..." %>
-
-<%= button_to_function "#{t('submit_for_debug')} » ", update_page { |page|
- page.hide :debug_submit_link
- page[:debug_submit_form].visual_effect :appear
- page[:app_log].visual_effect :fade
- } %>
-
-
-- -
-
diff --git a/app/views/debug/_debug_submit_failed.rjs b/app/views/debug/_debug_submit_failed.rjs
deleted file mode 100644
index 351cb7b7..00000000
--- a/app/views/debug/_debug_submit_failed.rjs
+++ /dev/null
@@ -1,2 +0,0 @@
-page[:thanks].replace_html "Debug report failed. Please do try again later."
-page.visual_effect :highlight, :thanks, { :duration => 8 }
diff --git a/app/views/debug/_debug_submit_worked.rjs b/app/views/debug/_debug_submit_worked.rjs
deleted file mode 100644
index be97213d..00000000
--- a/app/views/debug/_debug_submit_worked.rjs
+++ /dev/null
@@ -1,5 +0,0 @@
-page.visual_effect :fade, :debug_submit_form
-page[:thanks].replace_html "Debug report submitted. Your report ID is #{error_id}. Thanks for helping improve Amahi!"
-page.visual_effect :highlight, :thanks, { :duration => 14 }
-page[:subject].value = "Describe what failed here ..."
-page[:comments].value = "Click here to explain how the error occurred ..."
diff --git a/app/views/debug/_form.html.slim b/app/views/debug/_form.html.slim
new file mode 100644
index 00000000..145aef62
--- /dev/null
+++ b/app/views/debug/_form.html.slim
@@ -0,0 +1,18 @@
+- message_string = "\n\nExplain the sequence of events leading to the error\nin as much detail as you can.\n\nThe more *concrete detail* you can add,\nthe higher chances we fix the problem quickly!"
+
+= form_for :debug, :remote => true, :html => {\
+ :class => 'debug-form',\
+ :id => 'submit-debug-form'\
+ } do |f|
+ .control-group
+ h3.debug-form Help improve Amahi by sending crash reports and anonymous usage data.
+ .control-group
+ .controls= f.text_field :subject, :size => 32, :maxlength => 40, :placeholder => "Describe what failed here ...",:class=> "form-control debug-form"
+ .control-group
+ .controls
+ = text_area_tag :comments, '', :rows => 10, :cols => 80, :placeholder => message_string, :class=> "form-control debug-form"
+ .control-group.create-btn
+ .controls
+ = spinner
+ = button_tag 'Submit', :type => 'submit', :id => 'debug_button', :class => 'btn btn-submit btn-info btn-sm debug-form', :data=>{:confirm=>"Machine logs will be submitted to Amahi for debug.\nThis will help improve Amahi!\nWould you like to submit?"}
+ = link_to t('cancel'), '#', :class => 'close-area cancel-link debug-form', :data => {:related=> '#debug-button'}, :onclick=>"$('#debug-submit-form').hide('slow');"
\ No newline at end of file
diff --git a/app/views/debug/_logs.rhtml b/app/views/debug/_logs.rhtml
deleted file mode 100644
index 21c997ff..00000000
--- a/app/views/debug/_logs.rhtml
+++ /dev/null
@@ -1,4 +0,0 @@
-- <% text = SystemUtils.run "tail -100 #{Rails.root}/log/production.log" %> - <%= h text %> -- -<%= SystemUtils.run "grep -v \"hda dhcpd:\" #{Platform.file_name(:syslog)} | tail -100 | tac" %> -- diff --git a/app/views/debug/_system.rhtml b/app/views/debug/_system.rhtml deleted file mode 100644 index beb7fab7..00000000 --- a/app/views/debug/_system.rhtml +++ /dev/null @@ -1,6 +0,0 @@ - -<%= SystemUtils.uptime %> -<%= SystemUtils.run 'cat /proc/cpuinfo' %> -<%= SystemUtils.run 'cat /proc/meminfo' %> -- diff --git a/app/views/debug/index.html.slim b/app/views/debug/index.html.slim new file mode 100644 index 00000000..16eaea70 --- /dev/null +++ b/app/views/debug/index.html.slim @@ -0,0 +1,9 @@ + += button_tag 'Submit for Debug', :type => 'button', :class => 'open-area btn btn-create', :id => "debug-button", :data => { :related => "#debug-submit-form" } + +#debug-submit-form[style="display:none;"] + fieldset + legend Debug Report + = render 'form' +pre + = SystemUtils.run "tail -100 #{Rails.root}/log/production.log" diff --git a/app/views/debug/logs.html.slim b/app/views/debug/logs.html.slim new file mode 100644 index 00000000..86afa632 --- /dev/null +++ b/app/views/debug/logs.html.slim @@ -0,0 +1,3 @@ +pre + = SystemUtils.run "grep -v \"hda dhcpd:\" #{Platform.file_name(:syslog)} | tail -100 | tac" + diff --git a/app/views/debug/system.html.slim b/app/views/debug/system.html.slim new file mode 100644 index 00000000..2a852bfd --- /dev/null +++ b/app/views/debug/system.html.slim @@ -0,0 +1,4 @@ +pre + = SystemUtils.uptime + = SystemUtils.run 'cat /proc/cpuinfo' + = SystemUtils.run 'cat /proc/meminfo' \ No newline at end of file diff --git a/app/views/firewall/_new.html.erb b/app/views/firewall/_new.html.erb index 5e05c4d6..a9b3a279 100644 --- a/app/views/firewall/_new.html.erb +++ b/app/views/firewall/_new.html.erb @@ -1,6 +1,6 @@ -<%= button_to_function " #{t 'new_firewall_rule'} » ", update_page { |page| +<%= button_to " #{t 'new_firewall_rule'} » ", update_page { |page| page.hide 'new-firewall-to-step1' page.show 'new-firewall-step1' }, :id => "new-firewall-to-step1" %> diff --git a/app/views/firewall/_rule.html.erb b/app/views/firewall/_rule.html.erb index 99b040c6..e3e32694 100644 --- a/app/views/firewall/_rule.html.erb +++ b/app/views/firewall/_rule.html.erb @@ -15,7 +15,7 @@
|