From 0573f45e27ead93925f0694e764a51cc969585e2 Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Tue, 13 May 2014 15:33:24 -0700 Subject: [PATCH 01/34] Add ruyb 2.0 to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b0e4f33a..03762aba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: ruby rvm: - 1.9.3 + - 2.0.0 env: - DB=sqlite script: From 15c9616240148647cd69d708cc27af37ed7078cc Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Tue, 13 May 2014 16:17:18 -0700 Subject: [PATCH 02/34] Add ruby 2.1.0 as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 03762aba..836d5c30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: ruby rvm: - 1.9.3 - 2.0.0 + - 2.1.0 env: - DB=sqlite script: From 59db3043a17ef3eaa80a02e9a12952a67a8fbb9d Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Thu, 22 May 2014 01:57:34 -0700 Subject: [PATCH 03/34] use settings_engine.themes_path for themes' url --- plugins/040-apps/app/views/apps/_is_installed.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/040-apps/app/views/apps/_is_installed.html.slim b/plugins/040-apps/app/views/apps/_is_installed.html.slim index 0702bb93..3c18a7bf 100644 --- a/plugins/040-apps/app/views/apps/_is_installed.html.slim +++ b/plugins/040-apps/app/views/apps/_is_installed.html.slim @@ -25,7 +25,7 @@ div.app-url= link_to(app.plugin.name, app.plugin.path, :target => '_blank') - if app.theme - div.app-url= link_to(t('manage_themes'), app.full_url) + div.app-url= link_to(t('manage_themes'), settings_engine.themes_path) - if app.webapp = render 'in_dashboard', :app => app From 571c514a9d719cb867faff527e87176f45f56af5 Mon Sep 17 00:00:00 2001 From: Arpit Date: Tue, 27 May 2014 09:52:10 +0530 Subject: [PATCH 04/34] Adapting plugin gerator to rails 4. route definition changed. --- lib/generators/plugin/plugin_generator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/generators/plugin/plugin_generator.rb b/lib/generators/plugin/plugin_generator.rb index 99e820f6..76951aeb 100644 --- a/lib/generators/plugin/plugin_generator.rb +++ b/lib/generators/plugin/plugin_generator.rb @@ -110,8 +110,8 @@ class Engine < ::Rails::Engine # root of the plugin root :to => '#{plural_name}#index' # examples of controllers built in this generator. delete at will - match 'settings' => '#{plural_name}#settings' - match 'advanced' => '#{plural_name}#advanced' + match 'settings' => '#{plural_name}#settings',:via=> :all + match 'advanced' => '#{plural_name}#advanced',:via => :all end FILE end From a87bfcd954357f843cb1c3d391a2bcc89734085a Mon Sep 17 00:00:00 2001 From: Arpit Date: Wed, 28 May 2014 15:36:56 +0530 Subject: [PATCH 05/34] Stray message markup, and search hda routes corrected --- app/assets/stylesheets/login.css.scss | 4 ++-- .../themes/default/stylesheets/style.css.scss | 23 +++++++++++++++++++ app/controllers/application_controller.rb | 4 ++-- app/controllers/user_sessions_controller.rb | 17 +++++++------- app/views/shared/_flash_messages.html.slim | 3 ++- app/views/user_sessions/new.html.slim | 2 +- app/views/user_sessions/start.html.slim | 2 +- config/routes.rb | 2 +- 8 files changed, 41 insertions(+), 16 deletions(-) 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..09841fd1 100644 --- a/app/assets/themes/default/stylesheets/style.css.scss +++ b/app/assets/themes/default/stylesheets/style.css.scss @@ -1558,3 +1558,26 @@ 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; +} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2cc277db..9a329c6f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index f5e216c0..e8a4e3fa 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] = "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,7 +81,7 @@ 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 @@ -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/views/shared/_flash_messages.html.slim b/app/views/shared/_flash_messages.html.slim index dc3229bf..e1bc8347 100644 --- a/app/views/shared/_flash_messages.html.slim +++ b/app/views/shared/_flash_messages.html.slim @@ -1,3 +1,4 @@ #errors - flash.each do |name, msg| - div[id="flash_#{name}"]= msg \ No newline at end of file + div[class=" alert alert-#{name}"] + strong = msg \ No newline at end of file diff --git a/app/views/user_sessions/new.html.slim b/app/views/user_sessions/new.html.slim index b9bbd66c..69cf3cc5 100644 --- a/app/views/user_sessions/new.html.slim +++ b/app/views/user_sessions/new.html.slim @@ -4,7 +4,7 @@ a[href="http://www.amahi.org/" title="Powered by Amahi"] Amahi Server Login - flash.each do |name, msg| - div[class="message-#{name}"]= msg + div[class="alert alert-#{name}"]= msg = form_for @user_session do |f| p diff --git a/app/views/user_sessions/start.html.slim b/app/views/user_sessions/start.html.slim index ce030330..ed5b0378 100644 --- a/app/views/user_sessions/start.html.slim +++ b/app/views/user_sessions/start.html.slim @@ -4,7 +4,7 @@ a[href="http://www.amahi.org/" title="Powered by Amahi"] Amahi Server Login - flash.each do |name, msg| - div[class="message-#{name}"]= msg + div[class="alert alert-#{name}"]= msg = form_for @user, :url => initialize_system_path(@user.login) do |f| p diff --git a/config/routes.rb b/config/routes.rb index 438b0bda..53fe2c7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -34,7 +34,7 @@ resources :user_sessions, :hosts, :aliases - match 'search/:action' => 'search', :as => :search, via: [:get] + match 'search/:action' => 'search', :as => :search, via: [:get,:post] root :to => 'front#index' From 1bbad294470a5a38ef07c79bb14b50b9715885ae Mon Sep 17 00:00:00 2001 From: Arpit Date: Thu, 29 May 2014 11:42:05 +0530 Subject: [PATCH 06/34] Adding Back Debug Page --- app/assets/javascripts/application.js | 2 +- app/assets/javascripts/lib/debug.js.coffee | 24 +++++++ .../themes/default/stylesheets/style.css.scss | 5 ++ app/controllers/debug_controller.rb | 51 +++++++++++++++ app/controllers/front_controller.rb | 5 +- app/views/debug/_app_logs.rhtml | 51 --------------- app/views/debug/_debug_submit_failed.rjs | 2 - app/views/debug/_debug_submit_worked.rjs | 5 -- app/views/debug/_form.html.slim | 18 ++++++ app/views/debug/_logs.rhtml | 4 -- app/views/debug/_system.rhtml | 6 -- app/views/debug/index.html.slim | 9 +++ app/views/debug/logs.html.slim | 3 + app/views/debug/system.html.slim | 4 ++ app/views/layouts/debug.html.slim | 63 +++++++++++++++++++ config/routes.rb | 5 +- 16 files changed, 184 insertions(+), 73 deletions(-) create mode 100644 app/assets/javascripts/lib/debug.js.coffee create mode 100644 app/controllers/debug_controller.rb delete mode 100644 app/views/debug/_app_logs.rhtml delete mode 100644 app/views/debug/_debug_submit_failed.rjs delete mode 100644 app/views/debug/_debug_submit_worked.rjs create mode 100644 app/views/debug/_form.html.slim delete mode 100644 app/views/debug/_logs.rhtml delete mode 100644 app/views/debug/_system.rhtml create mode 100644 app/views/debug/index.html.slim create mode 100644 app/views/debug/logs.html.slim create mode 100644 app/views/debug/system.html.slim create mode 100644 app/views/layouts/debug.html.slim 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/themes/default/stylesheets/style.css.scss b/app/assets/themes/default/stylesheets/style.css.scss index 09841fd1..b9123747 100644 --- a/app/assets/themes/default/stylesheets/style.css.scss +++ b/app/assets/themes/default/stylesheets/style.css.scss @@ -1580,4 +1580,9 @@ border-radius: 4px; 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/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/views/debug/_app_logs.rhtml b/app/views/debug/_app_logs.rhtml deleted file mode 100644 index e4d49dd6..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 ..." %> - - -
-
-
-
-	<% text = SystemUtils.run "tail -100 #{Rails.root}/log/production.log" %>
-	<%= h text %> 
-	
-
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 @@ -
-<%= 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..7739d793 --- /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/development.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/layouts/debug.html.slim b/app/views/layouts/debug.html.slim new file mode 100644 index 00000000..b1253a24 --- /dev/null +++ b/app/views/layouts/debug.html.slim @@ -0,0 +1,63 @@ +doctype 5 +html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] + head + meta charset="utf-8" + title = full_page_title + + = stylesheet_link_tag 'application' + + - if theme.name != "default" and theme.disable_inheritance == false + = stylesheet_link_tag(theme_stylesheet_path('style', theme.default)) + = stylesheet_link_tag(theme_stylesheet_path('rtl', theme.default)) if rtl? + + = theme_stylesheet_link_tag 'style' + = theme_stylesheet_link_tag('rtl') if rtl? + - amahi_plugins.each do |p| + = stylesheet_link_tag p[:class].underscore + + /[ if lt IE 9 ] + = javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js' + + = javascript_tag {render 'shared/js_vars'} + = javascript_include_tag 'application' + - amahi_plugins.each do |p| + = javascript_include_tag p[:class].underscore + + = javascript_tag {'$.fx.off = true;' if Rails.env.test?} + - for header in theme.headers do + = header =~ /\.js$/ ? javascript_include_tag(header) : header + + link rel="search" type="application/opensearchdescription+xml" title="HDA Search" href="/search.xml" + link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" + + = csrf_meta_tags + + body + + = render 'layouts/header' + + #content + = render 'layouts/subheader' + = render 'shared/flash_messages' + #app.inner + #tabs + nav.preftab + ul + li.active + a href='/tab/debug' + = t 'debug' + ul + li[class="#{request.fullpath == '/tab/debug' ? 'active' : ''}"] + = link_to "App Logs", '/tab/debug' + li[class="#{request.fullpath == '/tab/debug/logs' ? 'active' : ''}"] + = link_to "Logs", '/tab/debug/logs' + li[class="#{request.fullpath == '/tab/debug/system' ? 'active' : ''}"] + = link_to "System Info", '/tab/debug/system' + #preferences + .preftab + = yield + + = render 'layouts/footer' + + #js-templates[style="display:none"] + = yield :js_templates diff --git a/config/routes.rb b/config/routes.rb index 53fe2c7a..81993755 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,10 @@ match 'logout' => 'user_sessions#destroy', :as => :logout, via: [:get] match 'start' => 'user_sessions#start', :as => :start, via: [:get] match 'user_sessions/initialize_system' => 'user_sessions#initialize_system', :as => :initialize_system, via: [:get,:post] - + get '/tab/debug'=>'debug#index' + post '/tab/debug'=>'debug#submit' + get '/tab/debug/system'=>'debug#system' + get '/tab/debug/logs'=>'debug#logs' resources :shares do collection do get 'disk_pooling' From 33dd8c9bda46cf50b5c3941931a58e2d29246adc Mon Sep 17 00:00:00 2001 From: Arpit Date: Thu, 29 May 2014 12:01:43 +0530 Subject: [PATCH 07/34] Attribute should be data confirm Signed-off-by: Arpit Goyal --- plugins/080-settings/app/views/settings/index.html.slim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/080-settings/app/views/settings/index.html.slim b/plugins/080-settings/app/views/settings/index.html.slim index d580df20..4d997410 100644 --- a/plugins/080-settings/app/views/settings/index.html.slim +++ b/plugins/080-settings/app/views/settings/index.html.slim @@ -42,14 +42,14 @@ div.settings-fields.settings-wrap method: :post, class: 'btn-system', id: 'btn-poweroff', - confirm: t('this_will_power_off') + data: {confirm: t('this_will_power_off')} = link_to t('reboot'), settings_engine.reboot_path, remote: true, method: :post, class: 'btn-system', id: 'btn-reboot', - confirm: t('this_will_reboot') + data: {confirm: t('this_will_reboot')} div.settings-fields#info-table table tr From 655f9986b94bc071abadb17644e565d065ce72d7 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Thu, 29 May 2014 15:05:18 +0530 Subject: [PATCH 08/34] Localized string Signed-off-by: Arpit Goyal --- app/controllers/user_sessions_controller.rb | 2 +- config/locales/en.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index e8a4e3fa..c475a09c 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -45,7 +45,7 @@ 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] = "Logged in Successfully" + flash[:success] = t 'logged_in_successfully' redirect_to root_url else flash[:danger] = t 'not_a_valid_user_or_password' diff --git a/config/locales/en.yml b/config/locales/en.yml index 54433fd5..c66fe9c2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -39,6 +39,7 @@ # login log_in: Log In + logged_in_successfully: "Logged in successfully" not_a_valid_user_or_password: "Error: Incorrect username or password" first_time_admin_setup: "First admin setup. Please re-create your user password." remember_me: Remember me From 32d796b06ae5820c1fc5c6998131f7288be7d70f Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Fri, 30 May 2014 15:05:58 +0530 Subject: [PATCH 09/34] Allowing plugins to be added as a submenu of existing tab Signed-off-by: Arpit Goyal --- app/helpers/tabs_helper.rb | 15 ++++++-- app/views/shared/_tabs.html.slim | 4 +-- doc/plugins.md | 28 +++++++++++++-- lib/tab.rb | 35 +++++++++++++++++++ .../config/initializers/plugin_init.rb | 2 ++ 5 files changed, 77 insertions(+), 7 deletions(-) diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb index 2595ba1a..64a0b447 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 + tab = Tab.find(params[:controller]) + if tab==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) diff --git a/app/views/shared/_tabs.html.slim b/app/views/shared/_tabs.html.slim index f7ac8da9..55e7a76a 100644 --- a/app/views/shared/_tabs.html.slim +++ b/app/views/shared/_tabs.html.slim @@ -9,9 +9,9 @@ ul - if @advanced - tab.advanced_subtabs.each do |subtab| - li[class=subtab_class(subtab.id)] + li[class=subtab_class(subtab.id,tab.id)] = link_to t(subtab.label), subtab.url - else - tab.basic_subtabs.each do |subtab| - li[class=subtab_class(subtab.id)] + li[class=subtab_class(subtab.id,tab.id)] = link_to t(subtab.label), subtab.url diff --git a/doc/plugins.md b/doc/plugins.md index 5a2eb2ae..80032e6a 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -22,13 +22,23 @@ Each plugin has to have a file called `config/amahi_plugin.yml` with details of name: Foo Bar Tab # class to be mounted class: FooBar - # kind of plugin (so far we only support 'tab' plugins) kind: tab # url where it will be mounted in the platform url: /tab/foobar No two apps have may use the same class or url to be mounted. +In case you are adding plugin as a subtab under a tab(Fuzzbar) : + + # human readable name (no localization supported yet) + # for example, it may be used as the text of the tab or the page title, etc. + name: Foo Bar Sub Tab + # class to be mounted + class: FooBar + kind: subtab + # url where it will be mounted in the platform + url: /tab/fuzzbar/foobar + ## Adding Tabs and Subtabs To add visible tabs in a plugin, one has to do it programmatically at plugin initialization time with what in RoR is known as an initializer. @@ -37,10 +47,13 @@ Example for initialization for a plugin (e.g. plugin/foo_bar/config/initializers ```ruby # plugin initialization -- set up a tab by calling Tab.new: +#Checks for Existing tab with the same controller. +unless t = Tab.find("foobar") # - first argument to Tab.new is the controller that it will hooked up to # - second argument is a string, the label for the tab. This will support internationalization in the future # - third argument is the route it should be mounted on, example /tab/foobar -t = Tab.new("foobar", "FooBar", "/tab/apps") + t = Tab.new("foobar", "FooBar", "/tab/apps") +end # add any subtabs to this tab with what you need. # The params are # - controller @@ -53,6 +66,17 @@ t.add("expert", "Expert Settings", true) t.add("other", "Other Settings") ``` +To add a plugin as a subtab of an existing tab(Fuzzbar) : +```ruby +# plugin initialization -- set up a tab by calling Tab.new: +#Checks for Existing tab with the same controller. +unless t = Tab.find("fuzzbar") + t = Tab.new("fuzzbar", "FuzzBar", "/tab/Fuzzbar") +end +t.add("foobar", "Foobar") +``` + + ## Principles * One folder = One plugin. This is a must. To install an Amahi plugin manually, all there needs to be done is copy a single folder into the plugins/ directory and done. It's good for manual installation, it's good for automatic installation. diff --git a/lib/tab.rb b/lib/tab.rb index eb8a2b3d..12da6c50 100644 --- a/lib/tab.rb +++ b/lib/tab.rb @@ -45,6 +45,41 @@ def advanced_subtabs subtabs end + # Return the Tab(if exists) with id:contoller. Otherwise creates a new Tab + def self.find_or_create(controller, label, url) + tabs = self.find(controller) + if tabs==nil + tabs = Tab.new(controller, label, url) + end + tabs + end + + #Returns Tab with id:controller + def self.find(controller) + tabs = [] + AmahiHDA::Application.config.tabs.each do |tab| + if tab.id==controller + tabs << tab + break + end + end + tabs.first + end + + #checks if tab has a subtab with id:controller + def self.ischild(controller,tab) + child = false + if tab.subtabs? + tab.subtabs.each do |subtab| + if(subtab.id == controller) + child = true + break + end + end + end + child + end + private # keep top-level tabs in an app variable, due to complex initialzation issues diff --git a/plugins/010-users/config/initializers/plugin_init.rb b/plugins/010-users/config/initializers/plugin_init.rb index c6fb72a1..adae4e22 100644 --- a/plugins/010-users/config/initializers/plugin_init.rb +++ b/plugins/010-users/config/initializers/plugin_init.rb @@ -1,4 +1,6 @@ +# plugin initialization t = Tab.new("users", "users", "/tab/users") +# add any subtabs with what you need. params are controller and the label t.add('index', "details") # disable settings for now # t.add('settings', "settings") From 0e194db7d97ec7c7c9dc9ca5f38618f561cf5f40 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sat, 31 May 2014 22:28:41 +0530 Subject: [PATCH 10/34] Debug Page for production, typo as development --- app/views/debug/index.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/debug/index.html.slim b/app/views/debug/index.html.slim index 7739d793..16eaea70 100644 --- a/app/views/debug/index.html.slim +++ b/app/views/debug/index.html.slim @@ -6,4 +6,4 @@ legend   Debug Report   = render 'form' pre - = SystemUtils.run "tail -100 #{Rails.root}/log/development.log" + = SystemUtils.run "tail -100 #{Rails.root}/log/production.log" From 53911e769730afee196756de204ebd2bab12f136 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sat, 31 May 2014 23:04:01 +0530 Subject: [PATCH 11/34] Edited on master but not in this branch --- plugins/040-apps/app/views/apps/_is_installed.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/040-apps/app/views/apps/_is_installed.html.slim b/plugins/040-apps/app/views/apps/_is_installed.html.slim index 0702bb93..3c18a7bf 100644 --- a/plugins/040-apps/app/views/apps/_is_installed.html.slim +++ b/plugins/040-apps/app/views/apps/_is_installed.html.slim @@ -25,7 +25,7 @@ div.app-url= link_to(app.plugin.name, app.plugin.path, :target => '_blank') - if app.theme - div.app-url= link_to(t('manage_themes'), app.full_url) + div.app-url= link_to(t('manage_themes'), settings_engine.themes_path) - if app.webapp = render 'in_dashboard', :app => app From 0c147275ef901ce08804763820aebf26cd9eb862 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sun, 1 Jun 2014 11:29:30 +0530 Subject: [PATCH 12/34] tab was already used, resolving naming error --- app/helpers/tabs_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb index 64a0b447..9b3f1887 100644 --- a/app/helpers/tabs_helper.rb +++ b/app/helpers/tabs_helper.rb @@ -20,8 +20,8 @@ def tab_class(tab) if params[:controller] == tab.id klass = 'active' else - tab = Tab.find(params[:controller]) - if tab==nil + subtab = Tab.find(params[:controller]) + if subtab==nil if Tab.ischild(params[:controller],tab) klass = 'active' end From 93c80b538e2da53e89771e31512111e5be19a9f8 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Wed, 4 Jun 2014 13:01:33 +0530 Subject: [PATCH 13/34] Adding changes to allow migration in plugins. Rectifying uninstallation error Signed-off-by: Arpit Goyal --- app/models/db.rb | 4 ++-- app/models/plugin.rb | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/models/db.rb b/app/models/db.rb index f26ae13d..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." 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 From f3e7057ae14e6782537fd3cd59737c93486dfd72 Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Thu, 5 Jun 2014 02:27:04 -0700 Subject: [PATCH 14/34] update app description, truncation. fixes #1397 --- plugins/040-apps/app/helpers/apps_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/040-apps/app/helpers/apps_helper.rb b/plugins/040-apps/app/helpers/apps_helper.rb index 99923bbb..c24a1b00 100644 --- a/plugins/040-apps/app/helpers/apps_helper.rb +++ b/plugins/040-apps/app/helpers/apps_helper.rb @@ -17,9 +17,9 @@ module AppsHelper def short_desc(app) - desc = app.description ? app.description.gsub(/<[^>]+>/, '') : t('no_description_supplied') - desc = truncate(strip_tags(desc), :length => 70, :omission => ' ...') if desc.length > 70 - desc.html_safe + return t('no_description_supplied') unless app.description + # truncate if too long + truncate(strip_tags(app.description), length: 90) end def name_with_warning(app) From 4735f12f7af9a5b4b063416c76133bd08e9c9b59 Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Fri, 6 Jun 2014 14:39:59 -0700 Subject: [PATCH 15/34] cleanup - removal of unused file --- app/assets/images/rails.png | Bin 6646 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/assets/images/rails.png diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png deleted file mode 100644 index d5edc04e65f555e3ba4dcdaad39dc352e75b575e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6646 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 AQ~&?~ From e46189d753abf5bb147c297362face5fdec5e14d Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Fri, 6 Jun 2014 14:44:33 -0700 Subject: [PATCH 16/34] update opensearch icon to current logo --- app/assets/images/logo16x16.png | Bin 691 -> 694 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/logo16x16.png b/app/assets/images/logo16x16.png index a81c1b0b77ef47053ad32e69d0295e7770536641..a46636a604522ed99ca9131d5400f9e541f20333 100644 GIT binary patch delta 624 zcmV-$0+0Q(1-1o{QGebB1{Es}T<4w40006*NklfR6->ioXQR zL0tphBKUxPF>LAmN=9njUz40vzy9la^~qe#4(fru;Srvq;Y7*_xs zv0#mTHl@@n0e=H12U3951lS355-?KYZ%}K?pII2N28O);E}&L{Gu4_Nw{aZ66U_|j zPT*wX2G?e-=FLUQ0fxN(0f8!aq+=BrwTWbFu@=)~f$rrm)}7^H%ZL0S4|)CJBsRJo z%B%+#5*5S@>bI1oidRO}*y@z37PtsRfQ-X!BM|`Kk$-j#I0~HWt1LENpFhz8WCO@V zTj@jKCXkgN+}G9Fa2hBAt^(J9%ow&F&d+Xr(Rk)M;FgKDQuFr+icz(t-mQnM$&GO< zO&|wYn$z-sj3reSD$#Dp_6Dr^0~zhUrpu=!{Gg<9YhD$uk66~$oXP_{3CEOZ!!ugZ zvk6B<6KPNeFq^gik%V#!G{6fy1`hFmi*B;#X@7FP8__&Ki^P#oZb4e?58Ma#{v+7} zz5*YjBtQS;Y?x{uzZVrdE0kN13A8Hk%J%j30zE+QvB__9cK$Co`pEz#0*2WD0000< KMNUMnLSTZ&`5}M+ delta 621 zcmV-z0+Ri<1+xW^QGeG58x9o_p-f>_0000TbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJ zAXI2&AV*0}Q14_VZU6uR7fD1xR5;6hlHE=dQ4q&}=j?9FS8GYZQW6O21!^MIJ1-{wkJb#dJ9ga7x>xlL9<9 zX1Pg$UECR|U<9CQyAXE4cjFeGqiehWZ^5n<$%zwmZ%}s2XC{@z5E=xedM%vB37PEd z^%eL(wlKr1SAW&b6^_r1$oE`Q!sV>Ab$tuI?_*RquKEtT$oYrJ{G)$n(WYO1e?8z= zafcjrwBJU1ZJcw(^ilzlFMtZsUZl?jW$a3E6wo_(OQ%_<(`wRfH)*AonM$R}-+4gQ zHR-xdI&KrsvFU#Q5Fet`IKle4NvG$bHAn$HF+pwbb$|vUN>8)|y1-HbRII!0h}Yhciz|2=8)ER$uZLRE+(|J;Akm00000NkvXX Hu0mjf;7KMv From 7168534fe68cecac66ebf06c82414ecec5387b67 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sat, 7 Jun 2014 15:25:39 +0530 Subject: [PATCH 17/34] Patch for double spinner icons Signed-off-by: Arpit Goyal --- plugins/040-apps/app/views/apps/_is_installed.html.slim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/040-apps/app/views/apps/_is_installed.html.slim b/plugins/040-apps/app/views/apps/_is_installed.html.slim index 3c18a7bf..abda3d1d 100644 --- a/plugins/040-apps/app/views/apps/_is_installed.html.slim +++ b/plugins/040-apps/app/views/apps/_is_installed.html.slim @@ -20,12 +20,15 @@ - if app.webapp div.app-url= link_to(app.full_url, app.full_url, :target => '_blank') + = spinner - if app.plugin div.app-url= link_to(app.plugin.name, app.plugin.path, :target => '_blank') + = spinner - if app.theme div.app-url= link_to(t('manage_themes'), settings_engine.themes_path) + = spinner - if app.webapp = render 'in_dashboard', :app => app @@ -34,7 +37,6 @@ br br br -= spinner span.progress - unless app.has_dependents? span.install-button From b406679955d2bd0c9472afadf611d4731f3dfb5b Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Thu, 12 Jun 2014 11:18:59 +0530 Subject: [PATCH 18/34] Allowing name ans webapp id as attribute accesible --- app/models/webapp_alias.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/webapp_alias.rb b/app/models/webapp_alias.rb index c4cc1dad..a149ee4c 100644 --- a/app/models/webapp_alias.rb +++ b/app/models/webapp_alias.rb @@ -20,7 +20,7 @@ class WebappAlias < ActiveRecord::Base after_save :save_webapp after_destroy :save_webapp - + attr_accessible :name, :webapp_id validates :name, :presence => true, :uniqueness => true, From cbb26db09a3dda4fd66a8ef511a1a92480d25bb9 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Fri, 13 Jun 2014 12:12:08 +0530 Subject: [PATCH 19/34] conflicting routes with webapps Signed-off-by: Arpit Goyal --- plugins/040-apps/config/routes.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/040-apps/config/routes.rb b/plugins/040-apps/config/routes.rb index 5d17918b..1692b562 100644 --- a/plugins/040-apps/config/routes.rb +++ b/plugins/040-apps/config/routes.rb @@ -3,7 +3,6 @@ root :to => 'apps#index' # examples of controllers built in this generator. delete at will match 'installed' => 'apps#installed', via: [:get,:post] - match 'webapps' => 'apps#advanced', via: [:get,:post] post 'install/:id' => 'apps#install', as: 'install' match 'install_progress/:id' => 'apps#install_progress', as: 'install_progress', via: [:get,:post] From 7b9483487fc6f740356cb81a1a56765b9442eaa3 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Mon, 16 Jun 2014 14:42:20 +0530 Subject: [PATCH 20/34] Repo changes Signed-off-by: Arpit Goyal --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index d6e0a38b..78c6bcbf 100644 --- a/Gemfile +++ b/Gemfile @@ -13,14 +13,14 @@ gem 'therubyracer' gem 'uglifier' gem "activeresource", require: "active_resource" -gem 'protected_attributes' +gem 'protected_attributes' gem 'actionpack-action_caching' gem 'rails-observers' gem 'jbuilder' gem 'ya2yaml' -gem 'themes_for_rails', :git=>"https://github.com/agmps18/themes_for_rails.git" +gem 'themes_for_rails', :git=>"https://github.com/amahi/themes_for_rails.git" gem 'jquery-rails' gem 'jquery-ui-rails' From 69597d089aa637a79f7b511275890c6c51f27f7a Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Mon, 16 Jun 2014 03:24:57 -0700 Subject: [PATCH 21/34] bundle update, using our the_for_rails, update .ruby-version --- .ruby-version | 2 +- .rvmrc | 2 -- Gemfile | 2 +- Gemfile.lock | 48 ++++++++++++++++++++++++++---------------------- 4 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 .rvmrc 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 d6e0a38b..cddcd31f 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'rails-observers' gem 'jbuilder' gem 'ya2yaml' -gem 'themes_for_rails', :git=>"https://github.com/agmps18/themes_for_rails.git" +gem 'themes_for_rails', :git => "https://github.com/amahi/themes_for_rails.git" gem 'jquery-rails' gem 'jquery-ui-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 7a81e18e..7917ee32 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: https://github.com/agmps18/themes_for_rails.git - revision: f1cf020fecc8b4aa03caac956c13716f6943beb1 + remote: https://github.com/amahi/themes_for_rails.git + revision: e0f2e834ce27f19b287e964f18f027a9b4f172bb specs: themes_for_rails (0.5.1) rails (>= 3.0.0) @@ -48,7 +48,7 @@ GEM request_store (~> 1.0) bcrypt (3.1.7) builder (3.2.2) - capybara (2.2.1) + capybara (2.3.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -67,10 +67,10 @@ GEM 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) @@ -82,7 +82,7 @@ GEM rake hike (1.2.3) i18n (0.6.9) - jbuilder (2.0.7) + jbuilder (2.1.0) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) jquery-rails (3.1.0) @@ -101,16 +101,16 @@ GEM mime-types (1.25.1) mini_portile (0.6.0) minitest (5.3.4) - multi_json (1.10.0) + multi_json (1.10.1) mysql2 (0.3.16) nokogiri (1.6.2.1) mini_portile (= 0.6.0) - poltergeist (1.5.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.7) activemodel (>= 4.0.1, < 5.0) psych (2.0.5) @@ -140,19 +140,23 @@ GEM rake (10.3.2) rb-readline (0.5.1) 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.1) + rspec-support (~> 3.0.0) + rspec-expectations (3.0.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.0.0) + rspec-mocks (3.0.1) + 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) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-support (~> 3.0.0) + rspec-support (3.0.0) sass (3.2.19) sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) @@ -189,14 +193,14 @@ GEM eventmachine (>= 1.0.0) rack (>= 1.0.0) thor (0.19.1) - thread_safe (0.3.3) + thread_safe (0.3.4) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (1.1.0) + tzinfo (1.2.1) thread_safe (~> 0.1) - uglifier (2.5.0) + uglifier (2.5.1) execjs (>= 0.3.0) json (>= 1.8.0) unicorn (4.8.3) From 33c100bb00ab755f0aabaa6b3624450474f8181f Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Thu, 19 Jun 2014 16:21:02 +0530 Subject: [PATCH 22/34] Changes based on the generic conf --- app/models/webapp.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/webapp.rb b/app/models/webapp.rb index 6fc44865..0c220f62 100644 --- a/app/models/webapp.rb +++ b/app/models/webapp.rb @@ -104,7 +104,7 @@ def conf_file 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_ACCESS/, login_required ? access_conf : '') + conf = conf.gsub(/HDA_AUTHFILE/, "#{path}/htpasswd") conf = conf.gsub(/APP_ALIASES/, aliases || '') begin conf = conf.gsub(/APP_CUSTOM_OPTIONS/, custom_options || '') @@ -118,7 +118,7 @@ def conf_file end def access_conf - ["AuthUserFile /var/hda/web-apps/htpasswd", + ["AuthUserFile #{path}/htpasswd", "AuthGroupFile /dev/null", "AuthName \"User Login Required for This Area\"", "AuthType Basic", From 69edf6fdcfe4397d4f760ba64b1ff592bbd5f66d Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Fri, 20 Jun 2014 10:55:13 +0530 Subject: [PATCH 23/34] Introducing hda_access for apps using other kind of templates --- app/models/webapp.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/webapp.rb b/app/models/webapp.rb index 0c220f62..d8683193 100644 --- a/app/models/webapp.rb +++ b/app/models/webapp.rb @@ -105,6 +105,7 @@ def conf_file 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 conf = conf.gsub(/APP_CUSTOM_OPTIONS/, custom_options || '') @@ -118,7 +119,7 @@ def conf_file end def access_conf - ["AuthUserFile #{path}/htpasswd", + ["AuthUserFile /var/hda/web-apps/htpasswd", "AuthGroupFile /dev/null", "AuthName \"User Login Required for This Area\"", "AuthType Basic", From 3c23656fb394afb8e7dbf11cce85b7aa0b1ee01f Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Mon, 23 Jun 2014 11:48:19 +0530 Subject: [PATCH 24/34] Adding check for checkboxes bug 1451 Signed-off-by: Arpit Goyal --- .../080-settings/app/assets/javascripts/settings.js.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/080-settings/app/assets/javascripts/settings.js.coffee b/plugins/080-settings/app/assets/javascripts/settings.js.coffee index 7ab72470..4d0ed113 100644 --- a/plugins/080-settings/app/assets/javascripts/settings.js.coffee +++ b/plugins/080-settings/app/assets/javascripts/settings.js.coffee @@ -20,3 +20,10 @@ $ -> $ -> $(".preftab").on "ajax:success", "#locale", -> window.location.reload(true) + +$(document).on "click", ".remote-check", (event)-> + checkbox = $(this) + false + +$(document).on "ajax:complete",".remote-check", -> + $(this).prop("checked",!$(this).prop("checked")) From 3f3534d04e544cd569610019cb41740fa1bf5712 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Mon, 23 Jun 2014 12:49:01 +0530 Subject: [PATCH 25/34] be_true is renamed to be_truthy Signed-off-by: Arpit Goyal --- spec/features/admin_creation_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/admin_creation_spec.rb b/spec/features/admin_creation_spec.rb index beb85952..9a31c050 100644 --- a/spec/features/admin_creation_spec.rb +++ b/spec/features/admin_creation_spec.rb @@ -18,7 +18,7 @@ fill_in "password_confirmation", :with => "secret" click_button "Create" user = User.where(:login => username).first - user.admin.should be_true + user.admin.should be_truthy end end From addeace2a302ee08ebf6ba9f5bdb03c05141bd2f Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Mon, 23 Jun 2014 15:56:18 +0530 Subject: [PATCH 26/34] Removing webapps code, fix for bug 1398(duplicate spinner) Signed-off-by: Arpit Goyal --- .../controllers/webapp_alias_controller.rb | 52 ------- .../app/controllers/webapp_controller.rb | 146 ------------------ .../app/views/apps/_is_installed.html.slim | 5 +- .../040-apps/app/views/webapp/_body.html.erb | 4 - .../040-apps/app/views/webapp/_index.html.erb | 3 - .../040-apps/app/views/webapp/_list.html.erb | 41 ----- .../app/views/webapp/_login_required.html.erb | 12 -- .../app/views/webapp/_name_available.rjs | 5 - .../040-apps/app/views/webapp/_name_bad.rjs | 4 - .../app/views/webapp/_name_unavailable.rjs | 4 - .../040-apps/app/views/webapp/_new.html.erb | 30 ---- .../app/views/webapp/_path_available.rjs | 3 - .../040-apps/app/views/webapp/_path_bad.rjs | 3 - .../app/views/webapp/_path_exists.rjs | 3 - .../040-apps/app/views/webapp/_step1.rhtml | 59 ------- .../app/views/webapp/_webapp.html.erb | 120 -------------- .../app/views/webapp/_webapp_aliases.html.erb | 18 --- .../app/views/webapp_alias/new.js.erb | 16 -- 18 files changed, 1 insertion(+), 527 deletions(-) delete mode 100644 plugins/040-apps/app/controllers/webapp_alias_controller.rb delete mode 100644 plugins/040-apps/app/controllers/webapp_controller.rb delete mode 100644 plugins/040-apps/app/views/webapp/_body.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_index.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_list.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_login_required.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_name_available.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_name_bad.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_name_unavailable.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_new.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_path_available.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_path_bad.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_path_exists.rjs delete mode 100644 plugins/040-apps/app/views/webapp/_step1.rhtml delete mode 100644 plugins/040-apps/app/views/webapp/_webapp.html.erb delete mode 100644 plugins/040-apps/app/views/webapp/_webapp_aliases.html.erb delete mode 100644 plugins/040-apps/app/views/webapp_alias/new.js.erb diff --git a/plugins/040-apps/app/controllers/webapp_alias_controller.rb b/plugins/040-apps/app/controllers/webapp_alias_controller.rb deleted file mode 100644 index 40c6ffb7..00000000 --- a/plugins/040-apps/app/controllers/webapp_alias_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -# 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 WebappAliasController < ApplicationController - before_filter :admin_required - - def new - @id = params[:id] - end - - def index - @wa = Webapp.find(params[:id]) - raise "Webapp with id=#{params[:id]} cannot be found" unless @wa - render :partial => "webapp/webapp_aliases", :locals => { :webapp => @wa } - end - - def create - @wa = Webapp.find(params[:id]) - raise "Webapp with id=#{params[:id]} cannot be found" unless @wa - @waa = WebappAlias.where(:name=>params[:name]).first - if @waa - prev = @waa.webapp_id - @waa.webapp_id = @wa.id - @waa.save! - Webapp.find(prev).save - else - @waa = WebappAlias.create(:name => params[:name], :webapp_id => @wa.id) - end - render :partial => "webapp/webapp_aliases", :locals => { :webapp => @wa } - end - - def destroy - @waa = WebappAlias.find(params[:id]) rescue nil - @waa.destroy if @waa - @wa = Webapp.find(params[:webapp]) rescue nil - return unless @wa - render :partial => "webapp/webapp_aliases", :locals => { :webapp => @wa } - end -end diff --git a/plugins/040-apps/app/controllers/webapp_controller.rb b/plugins/040-apps/app/controllers/webapp_controller.rb deleted file mode 100644 index ba9fc886..00000000 --- a/plugins/040-apps/app/controllers/webapp_controller.rb +++ /dev/null @@ -1,146 +0,0 @@ -# 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 WebappController < ApplicationController - before_filter :admin_required - - VALID_NAME = Regexp.new "\A[A-Za-z][A-Za-z0-9\-]+\z" - - def create - # FIXME - check check check! - name = params[:name].strip - path = params[:path].sub(/\/+$/, '') - path.gsub!(/\/+/, '/') - wa = Webapp.create(:name => name, :path => path) - @webapps = Webapp.find :all - render :partial => "index" - end - - def delete - # FIXME - check check check! - wa = Webapp.find params[:id] - wa.destroy - webapps = Webapp.find(:all) - render :partial => 'list', :locals => { :webapps => webapps } - end - - def new_name_check - n = params[:name] - if n.nil? or n.blank? - render :partial => 'name_bad' - return - end - if (not (valid_name?(n))) or (n.size > 32) - render :partial => 'name_bad' - return - end - n = n.strip - a = DnsAlias.where(:alias=>n).first - if a.nil? - # no such alias, ok to create it - @name = n - render :partial => 'name_available' - else - render :partial => 'name_unavailable' - end - end - - def new_path_check - n = params[:path] - if n.nil? or n.blank? - render :partial => 'path_bad' - return - end - unless valid_path?(n) - render :partial => 'path_bad' - return - end - if File.exist? n - render :partial => 'path_exists' - else - render :partial => 'path_available' - end - end - - def update_name - id = params[:id] - wa = Webapp.find(id) - unless params[:value].blank? - name = params[:value] - wa.name = name - wa.save - wa.reload - end - name = wa.name - render :text => name - end - - def update_path - id = params[:id] - wa = Webapp.find(id) - unless params[:value].blank? - path = params[:value] - # check it exists! - if files_exist?(path) - wa.path = path - wa.save - wa.reload - else - # FIXME - report (somehow) why we did not - # make it! user must be confused!?! - # alternatively, create it! - raise PathDoesNotExist(path) - end - end - path = wa.path - render :text => path - end - - def toggle_login_required - begin - webapp = Webapp.find params[:id] - webapp.login_required = ! webapp.login_required - webapp.save - rescue - end - render :partial => 'login_required', :locals => { :webapp => webapp } - end - - -private - - def valid_name?(nm) - return false unless (nm =~ VALID_NAME) - true - end - - def valid_path?(path) - return false if path.size > 250 - return false unless path =~ /^\// - return false unless path =~ /\A[A-Za-z0-9_\/-]+\z/ - return false if path =~ /\/$/ - return false if path =~ /\/\/+/ - true - end - - def files_exist?(path) - return false unless File.exist?(path) - return false unless File.exist?(File.join(path, "html")) - return false unless File.exist?(File.join(path, "logs")) - true - end - -end diff --git a/plugins/040-apps/app/views/apps/_is_installed.html.slim b/plugins/040-apps/app/views/apps/_is_installed.html.slim index abda3d1d..d5077c43 100644 --- a/plugins/040-apps/app/views/apps/_is_installed.html.slim +++ b/plugins/040-apps/app/views/apps/_is_installed.html.slim @@ -20,7 +20,7 @@ - if app.webapp div.app-url= link_to(app.full_url, app.full_url, :target => '_blank') - = spinner + = render 'in_dashboard', :app => app - if app.plugin div.app-url= link_to(app.plugin.name, app.plugin.path, :target => '_blank') @@ -30,9 +30,6 @@ div.app-url= link_to(t('manage_themes'), settings_engine.themes_path) = spinner -- if app.webapp - = render 'in_dashboard', :app => app - br br br diff --git a/plugins/040-apps/app/views/webapp/_body.html.erb b/plugins/040-apps/app/views/webapp/_body.html.erb deleted file mode 100644 index 26f897da..00000000 --- a/plugins/040-apps/app/views/webapp/_body.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= render :partial => 'webapp/list', :locals => { :webapps => webapps } %> -
-
-<%= render :partial => 'webapp/new' %> diff --git a/plugins/040-apps/app/views/webapp/_index.html.erb b/plugins/040-apps/app/views/webapp/_index.html.erb deleted file mode 100644 index 1fee0cfe..00000000 --- a/plugins/040-apps/app/views/webapp/_index.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
- <%= render :partial => 'webapp/body', :locals => { :webapps => @webapps } %> -
diff --git a/plugins/040-apps/app/views/webapp/_list.html.erb b/plugins/040-apps/app/views/webapp/_list.html.erb deleted file mode 100644 index 35f59936..00000000 --- a/plugins/040-apps/app/views/webapp/_list.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -
-
- <% if webapps.size > 0 %> - - - - - - - - -
<%=t 'name' %><%=t 'url' %>
- <%= render :partial => 'webapp/webapp', :collection => webapps %> - <% else %> -
-
-

<%=t 'there_are_no_webapps' %>

-

Web apps are web-based applications hosted in your Amahi HDA.

-

Example of web apps are Wordpress, - MediaWiki, - Gallery, - Webmin and - PHPSysinfo.

-

There are a myriad of other apps that run under Linux.

-

You can install web apps in this panel by:

-

-

    -
  • Deciding what name you want to access the web app within your network (e.g. http://blog), and
  • -
  • Selecting where is the root directory of the app you want to run
  • -
-

-

The application code is expected to be present (before or after configuring the app) in the root directory.

-

You can install it there as an archive from source (tar/zip), or as a package from existing applications in the base OS.

-

Currently supported are applications based on LAMP (PHP), Python, static pages and others.

-

We have a small gallery of apps that other Amahi - developers and users have tried and tested.

-
-
- <% end %> -
-
diff --git a/plugins/040-apps/app/views/webapp/_login_required.html.erb b/plugins/040-apps/app/views/webapp/_login_required.html.erb deleted file mode 100644 index fda3856c..00000000 --- a/plugins/040-apps/app/views/webapp/_login_required.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% id = "login_required_#{webapp.id}" %> - -<%= checkbox_to_remote webapp.login_required, - :url => { :controller => 'webapp', :action => 'toggle_login_required', :id => webapp }, - :submit => id, - :before => "Element.show('spinner-access-#{webapp.id}')", - :success => "Element.hide('spinner-access-#{webapp.id}')", - :update => id -%> -  <%=t 'require_login' %>     » <%= theme_image_tag "more" %> -<%= spinner "access-#{webapp.id}" %> - - diff --git a/plugins/040-apps/app/views/webapp/_name_available.rjs b/plugins/040-apps/app/views/webapp/_name_available.rjs deleted file mode 100644 index f280ce64..00000000 --- a/plugins/040-apps/app/views/webapp/_name_available.rjs +++ /dev/null @@ -1,5 +0,0 @@ -page[:name_messages].replace_html theme_image_tag("ok") + " " + t('name_looks_good') -page.show 'name_messages' -page[:path].disabled = false -# FIXME - this path needs parametrization -page[:path].value = "/var/hda/web-apps/" + @name diff --git a/plugins/040-apps/app/views/webapp/_name_bad.rjs b/plugins/040-apps/app/views/webapp/_name_bad.rjs deleted file mode 100644 index 61bebc60..00000000 --- a/plugins/040-apps/app/views/webapp/_name_bad.rjs +++ /dev/null @@ -1,4 +0,0 @@ -page[:name_messages].replace_html theme_image_tag("stop") + " " + t('name_is_not_valid') -page.show 'name_messages' -page[:path].disabled = true -page[:webapp_create_button].disabled = true diff --git a/plugins/040-apps/app/views/webapp/_name_unavailable.rjs b/plugins/040-apps/app/views/webapp/_name_unavailable.rjs deleted file mode 100644 index 6735e220..00000000 --- a/plugins/040-apps/app/views/webapp/_name_unavailable.rjs +++ /dev/null @@ -1,4 +0,0 @@ -page[:name_messages].replace_html theme_image_tag("stop") + " " + t('name_is_taken_already') -page.show 'name_messages' -page[:path].disabled = true -page[:webapp_create_button].disabled = true diff --git a/plugins/040-apps/app/views/webapp/_new.html.erb b/plugins/040-apps/app/views/webapp/_new.html.erb deleted file mode 100644 index 1a89f9dd..00000000 --- a/plugins/040-apps/app/views/webapp/_new.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%= button_to " #{t('new_web_app')} » ", update_page { |page| - page.hide 'new-webapp-to-step1' - page[:name].value = "" - page[:path].value = "" - page[:webapp_create_button].disabled = true - page.select(".messages").each do |item| - page.send 'replace_html', item, "" - end - page.show 'new-webapp-step1' - page[:name].focus - }, :id => "new-webapp-to-step1" %> - -
-
-
- -
- <%= error_messages_for :setup %> -
- - <% form_for :webapp, :id => "webapp-new", :url => { :controller => 'webapp', :action => 'create' } do |f| -%> - - - - <% end %> -
-
-
diff --git a/plugins/040-apps/app/views/webapp/_path_available.rjs b/plugins/040-apps/app/views/webapp/_path_available.rjs deleted file mode 100644 index 2207150f..00000000 --- a/plugins/040-apps/app/views/webapp/_path_available.rjs +++ /dev/null @@ -1,3 +0,0 @@ -page[:path_messages].replace_html theme_image_tag("ok") + " " + t('path_looks_good') -page.show 'path_messages' -page[:webapp_create_button].disabled = false diff --git a/plugins/040-apps/app/views/webapp/_path_bad.rjs b/plugins/040-apps/app/views/webapp/_path_bad.rjs deleted file mode 100644 index 7dbc8c4c..00000000 --- a/plugins/040-apps/app/views/webapp/_path_bad.rjs +++ /dev/null @@ -1,3 +0,0 @@ -page[:path_messages].replace_html theme_image_tag("stop") + " " + t('this_path_is_not_valid') -page.show 'path_messages' -page[:webapp_create_button].disabled = true diff --git a/plugins/040-apps/app/views/webapp/_path_exists.rjs b/plugins/040-apps/app/views/webapp/_path_exists.rjs deleted file mode 100644 index 9602a90a..00000000 --- a/plugins/040-apps/app/views/webapp/_path_exists.rjs +++ /dev/null @@ -1,3 +0,0 @@ -page[:path_messages].replace_html theme_image_tag("warning") + " " + t('this_path_exists_already') -page.show 'path_messages' -page[:webapp_create_button].disabled = false diff --git a/plugins/040-apps/app/views/webapp/_step1.rhtml b/plugins/040-apps/app/views/webapp/_step1.rhtml deleted file mode 100644 index aa7b4dc6..00000000 --- a/plugins/040-apps/app/views/webapp/_step1.rhtml +++ /dev/null @@ -1,59 +0,0 @@ - - - -
-
-  <%=t 'create_a_new_webapp' %>   -
- - - - - - - - - - - - - - - - - - - -
<%= text_field_tag :name, "", :size => 16, :maxlength => 20 %>» <%= theme_image_tag "more" %>
<%= text_field_tag :path, "", :size => 38, :maxlength => 128, :disabled => true %>/html
  
  - <%= link_to t('cancel'), update_page { |page| - page.hide 'new-webapp-step1' - page.show 'new-webapp-to-step1' - page[:name].value = "" - page[:path].value = "" - page.select(".messages").each do |item| - page.send 'replace_html', item, "" - end - page[:path].disabled = true - page[:webapp_create_button].disabled = true - } %> -    - <%= submit_to_remote "create_webapp", " #{t('create')} » ", - :url => { :controller => 'webapp', :action => 'create' }, - :html => { :id => "webapp_create_button", :disabled => true }, - :failure => "alert('HTTP Error ' + request.status + '!')", - :update => { :success => "webapps", :failure => "create_webapp_error_msgs" } %> -
-
-
-
- - - -<%= observe_field 'name', :frequency => 0.5, - :url => { :controller => 'webapp', :action => 'new_name_check' }, - :with => "'name=' + encodeURIComponent(value)" %> -<%= observe_field 'path', :frequency => 0.5, - :url => { :controller => 'webapp', :action => 'new_path_check' }, - :with => "'path=' + encodeURIComponent(value)" %> - -
diff --git a/plugins/040-apps/app/views/webapp/_webapp.html.erb b/plugins/040-apps/app/views/webapp/_webapp.html.erb deleted file mode 100644 index 4b38a9c6..00000000 --- a/plugins/040-apps/app/views/webapp/_webapp.html.erb +++ /dev/null @@ -1,120 +0,0 @@ -<% - delete_icon = theme_image_tag("delete", :title => t('delete_web_app')) - webapp = webapp - uid = webapp.id.to_s - return if webapp.nil? - toggler = update_page { |page| - row = "webapp_row_" + uid.to_s - info = "webapp_info_" + uid.to_s - page.toggle info - page[row].toggle_class_name "settings-row-open" - } -%> - - - - - -
- <%= link_to(h(webapp.name), '') %> - - http://<%= h webapp.name %> -
- - diff --git a/plugins/040-apps/app/views/webapp/_webapp_aliases.html.erb b/plugins/040-apps/app/views/webapp/_webapp_aliases.html.erb deleted file mode 100644 index 8d434f88..00000000 --- a/plugins/040-apps/app/views/webapp/_webapp_aliases.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% uid = webapp.id.to_s %> - - -<%= link_to_remote t('new_alias'), - :update => "webapp_aliases_new_#{uid}", - :before => spinner_show(uid), - :success => spinner_hide(uid), - :url => { :controller => 'webapp_alias', :action => 'new', :id => uid } %> -    » <%= theme_image_tag "more" %> - -<%= webapp.webapp_aliases.count > 0 ? "

" : "" %> - <%= webapp.webapp_aliases.map do |a| - del = link_to_remote("x", :update => "webapp_aliases_#{uid}", :before => spinner_show(uid), :success => spinner_hide(uid), :url => { :controller => 'webapp_alias', :action => 'destroy', :id => a.id, :webapp => uid }); - link = link_to("http://#{a}", "http://#{a}", { :target => '_blank'}) - "[#{del}] #{link}" - end.join("
") -%> -
diff --git a/plugins/040-apps/app/views/webapp_alias/new.js.erb b/plugins/040-apps/app/views/webapp_alias/new.js.erb deleted file mode 100644 index a6db9125..00000000 --- a/plugins/040-apps/app/views/webapp_alias/new.js.erb +++ /dev/null @@ -1,16 +0,0 @@ -
-<%= text_field_tag :wa_alias, "", :size => 16, :maxlenth => 80 %> -<%= submit_to_remote "add_alias", " #{t 'create'} ", - :url => { :controller => 'webapp_alias', :action => 'create', :id => @id }, - :with => "'name=' + escape($('wa_alias').value)", - :before => spinner_show(@id), - :success => spinner_hide(@id), - :update => { :success => "webapp_aliases_#{@id}"} %> -  <%= link_to_remote t('cancel'), - :url => { :controller => 'webapp_alias', :action => 'index', :id => @id }, - :before => spinner_show(@id), - :success => spinner_hide(@id), - :update => { :success => "webapp_aliases_#{@id}"} - %> -
-
From 3618fb7133f41dfa483a33b198627e721110da75 Mon Sep 17 00:00:00 2001 From: Kasun Thennakoon Date: Tue, 24 Jun 2014 16:25:33 +0530 Subject: [PATCH 27/34] RAILS_DEFAULT_LOGGER is deprecated, use Rails.logger.error instead --- lib/partition_utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/partition_utils.rb b/lib/partition_utils.rb index 8739155e..219efc19 100644 --- a/lib/partition_utils.rb +++ b/lib/partition_utils.rb @@ -77,7 +77,7 @@ def disk_stats(path) # return total bytes, free bytes [blocks * bsize, bfree * bsize] rescue => e - RAILS_DEFAULT_LOGGER.error("******** disk stats error for #{path}: #{e.inspect}") + Rails.logger.error("******** disk stats error for #{path}: #{e.inspect}") [0, 0] end end From 4451cb4f4b8df9a17637a5fc62b8fc70c549ed1e Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Tue, 24 Jun 2014 17:43:14 -0700 Subject: [PATCH 28/34] update bundle, use system bundler to package the gems properly --- Gemfile.lock | 18 +++++++++--------- Makefile | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7917ee32..bbb5785a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,10 +82,10 @@ GEM rake hike (1.2.3) i18n (0.6.9) - jbuilder (2.1.0) + jbuilder (2.1.1) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - 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) @@ -100,7 +100,7 @@ GEM treetop (~> 1.4.8) mime-types (1.25.1) mini_portile (0.6.0) - minitest (5.3.4) + minitest (5.3.5) multi_json (1.10.1) mysql2 (0.3.16) nokogiri (1.6.2.1) @@ -111,10 +111,10 @@ GEM multi_json (~> 1.0) websocket-driver (>= 0.2.0) polyglot (0.3.5) - protected_attributes (1.0.7) + 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.5.2) rack-test (0.6.2) @@ -141,12 +141,12 @@ GEM rb-readline (0.5.1) ref (1.0.5) request_store (1.0.6) - rspec-core (3.0.1) + rspec-core (3.0.2) rspec-support (~> 3.0.0) - rspec-expectations (3.0.1) + rspec-expectations (3.0.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.0.0) - rspec-mocks (3.0.1) + rspec-mocks (3.0.2) rspec-support (~> 3.0.0) rspec-rails (3.0.1) actionpack (>= 3.0) @@ -156,7 +156,7 @@ GEM rspec-expectations (~> 3.0.0) rspec-mocks (~> 3.0.0) rspec-support (~> 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) diff --git a/Makefile b/Makefile index 1f7c2f8d..8f1cfce9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ 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 distclean: clean rm -rf vendor/bundle From fe21d882627a67a45dde4d53a7bb2ccfbac784e9 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Wed, 25 Jun 2014 13:49:28 +0530 Subject: [PATCH 29/34] solving bug 1451 Signed-off-by: Arpit Goyal --- plugins/080-settings/app/assets/javascripts/settings.js.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/080-settings/app/assets/javascripts/settings.js.coffee b/plugins/080-settings/app/assets/javascripts/settings.js.coffee index 4d0ed113..c3aa01e3 100644 --- a/plugins/080-settings/app/assets/javascripts/settings.js.coffee +++ b/plugins/080-settings/app/assets/javascripts/settings.js.coffee @@ -23,7 +23,8 @@ $ -> $(document).on "click", ".remote-check", (event)-> checkbox = $(this) - false + checkbox.prop("checked",!checkbox.prop("checked")) + true $(document).on "ajax:complete",".remote-check", -> $(this).prop("checked",!$(this).prop("checked")) From d814a2ef3fb5da4aa09613f7070b2f48bf8c2ec6 Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Wed, 25 Jun 2014 18:41:04 -0700 Subject: [PATCH 30/34] aggressive cleanup of gem artifacts not needed at run time. 300 to 400% reduction in size --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 8f1cfce9..fec15e37 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,11 @@ bundle: /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 From ceb4ed74c53ca941cef74125ec24579183ba3045 Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sat, 28 Jun 2014 04:23:10 +0530 Subject: [PATCH 31/34] Adding migration for changing custom_options column to text type --- ...0627195608_change_custom_options_to_text_field.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/migrate/20140627195608_change_custom_options_to_text_field.rb diff --git a/db/migrate/20140627195608_change_custom_options_to_text_field.rb b/db/migrate/20140627195608_change_custom_options_to_text_field.rb new file mode 100644 index 00000000..8c8d9f2f --- /dev/null +++ b/db/migrate/20140627195608_change_custom_options_to_text_field.rb @@ -0,0 +1,12 @@ +class ChangeCustomOptionsToTextField < ActiveRecord::Migration + def up + change_table :webapps do |t| + t.change :custom_options, :text, :default => nil + end + end + def down + change_table :webapps do |t| + t.change :custom_options, :string, :default => "" + end + end +end From 3d2e04577c456edee47f32ee9c4af6f6ff016725 Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Sat, 28 Jun 2014 00:45:28 -0700 Subject: [PATCH 32/34] update .ruby-version and update schema.rb to the latest --- .ruby-version | 2 +- db/schema.rb | 160 +++++++++++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/.ruby-version b/.ruby-version index c506e4ef..7fa1d1ef 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.0.0-p353 +2.0.0-p353 diff --git a/db/schema.rb b/db/schema.rb index 69ae69c4..18f11e2e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,18 +9,18 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140419104547) do +ActiveRecord::Schema.define(version: 20140627195608) do - create_table "app_dependencies", :force => true do |t| + create_table "app_dependencies", force: true do |t| t.integer "app_id" t.integer "dependency_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "apps", :force => true do |t| + create_table "apps", force: true do |t| t.boolean "installed" t.string "name" t.string "screenshot_url" @@ -31,7 +31,7 @@ t.string "logo_url" t.integer "webapp_id" t.string "status" - t.boolean "show_in_dashboard", :default => true + t.boolean "show_in_dashboard", default: true t.string "forum_url" t.integer "theme_id" t.text "special_instructions" @@ -40,107 +40,107 @@ t.integer "share_id" t.string "initial_user" t.string "initial_password" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "plugin_id" end - create_table "cap_accesses", :force => true do |t| + create_table "cap_accesses", force: true do |t| t.integer "user_id" t.integer "share_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "cap_writers", :force => true do |t| + create_table "cap_writers", force: true do |t| t.integer "user_id" t.integer "share_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "dbs", :force => true do |t| - t.string "name", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "dbs", force: true do |t| + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "dns_aliases", :force => true do |t| - t.string "name", :default => "", :null => false - t.string "address", :default => "", :null => false + create_table "dns_aliases", force: true do |t| + t.string "name", default: "", null: false + t.string "address", default: "", null: false end - create_table "firewalls", :force => true do |t| - t.string "kind", :default => "" - t.boolean "state", :default => true - t.string "ip", :default => "" - t.string "protocol", :default => "both" - t.string "range", :default => "" - t.string "mac", :default => "" - t.string "url", :default => "" - t.string "comment", :default => "" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "firewalls", force: true do |t| + t.string "kind", default: "" + t.boolean "state", default: true + t.string "ip", default: "" + t.string "protocol", default: "both" + t.string "range", default: "" + t.string "mac", default: "" + t.string "url", default: "" + t.string "comment", default: "" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "hosts", :force => true do |t| - t.string "name", :default => "", :null => false - t.string "mac", :default => "" + create_table "hosts", force: true do |t| + t.string "name", default: "", null: false + t.string "mac", default: "" t.string "address" end - create_table "plugins", :force => true do |t| + create_table "plugins", force: true do |t| t.string "name" t.string "path" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "servers", :force => true do |t| - t.string "name", :null => false - t.string "comment", :default => "" + create_table "servers", force: true do |t| + t.string "name", null: false + t.string "comment", default: "" t.string "pidfile" t.string "start" t.string "stop" - t.boolean "monitored", :default => true - t.boolean "start_at_boot", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.boolean "monitored", default: true + t.boolean "start_at_boot", default: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "settings", :force => true do |t| + create_table "settings", force: true do |t| t.string "name" t.string "value" - t.string "kind", :default => "general" + t.string "kind", default: "general" end - create_table "shares", :force => true do |t| + create_table "shares", force: true do |t| t.string "name" t.string "path" t.boolean "rdonly" t.boolean "visible" - t.boolean "everyone", :default => true - t.string "tags", :default => "" + t.boolean "everyone", default: true + t.string "tags", default: "" t.text "extras" - t.integer "disk_pool_copies", :default => 0 - t.boolean "guest_access", :default => false - t.boolean "guest_writeable", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "disk_pool_copies", default: 0 + t.boolean "guest_access", default: false + t.boolean "guest_writeable", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "themes", :force => true do |t| - t.string "name", :default => "", :null => false - t.string "css", :default => "", :null => false + create_table "themes", force: true do |t| + t.string "name", default: "", null: false + t.string "css", default: "", null: false end - create_table "users", :force => true do |t| - t.string "login", :null => false + create_table "users", force: true do |t| + t.string "login", null: false t.string "name" t.string "crypted_password" t.string "password_salt" t.string "persistence_token" - t.integer "login_count", :default => 0, :null => false + t.integer "login_count", default: 0, null: false t.datetime "last_request_at" t.datetime "last_login_at" t.datetime "current_login_at" @@ -148,29 +148,29 @@ t.string "current_login_ip" t.boolean "admin" t.text "public_key" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "webapp_aliases", :force => true do |t| + create_table "webapp_aliases", force: true do |t| t.string "name" t.integer "webapp_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "webapps", :force => true do |t| - t.string "name", :null => false - t.string "path", :default => "" - t.string "kind", :default => "" - t.string "aliases", :default => "" - t.string "fname", :default => "" - t.boolean "deletable", :default => true - t.boolean "login_required", :default => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "webapps", force: true do |t| + t.string "name", null: false + t.string "path", default: "" + t.string "kind", default: "" + t.string "aliases", default: "" + t.string "fname", default: "" + t.boolean "deletable", default: true + t.boolean "login_required", default: false t.integer "dns_alias_id" - t.string "custom_options", :default => "" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.text "custom_options" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end end From 17a35771246ac008236b225f80a5614b3ae53ecc Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Sat, 28 Jun 2014 00:54:46 -0700 Subject: [PATCH 33/34] update bin stubs to rails 4 --- bin/bundle | 3 +++ bin/rails | 18 +++--------------- bin/rake | 18 +++--------------- 3 files changed, 9 insertions(+), 30 deletions(-) create mode 100755 bin/bundle diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 00000000..66e9889e --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 657440d2..728cd85a 100755 --- a/bin/rails +++ b/bin/rails @@ -1,16 +1,4 @@ #!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'rails' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('railties', 'rails') +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 26c7a2d5..17240489 100755 --- a/bin/rake +++ b/bin/rake @@ -1,16 +1,4 @@ #!/usr/bin/env ruby -# -# This file was generated by Bundler. -# -# The application 'rake' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -require 'rubygems' -require 'bundler/setup' - -load Gem.bin_path('rake', 'rake') +require_relative '../config/boot' +require 'rake' +Rake.application.run From d8680089ff0d9593f3085cbc721ecf343cbd315f Mon Sep 17 00:00:00 2001 From: Arpit Goyal Date: Sat, 5 Jul 2014 00:22:48 +0530 Subject: [PATCH 34/34] Changes to adapt bootstrap theme Signed-off-by: Arpit Goyal --- app/views/debug/_form.html.slim | 12 ++++++------ app/views/layouts/basic.html.slim | 2 +- app/views/layouts/debug.html.slim | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/debug/_form.html.slim b/app/views/debug/_form.html.slim index 145aef62..ca244a21 100644 --- a/app/views/debug/_form.html.slim +++ b/app/views/debug/_form.html.slim @@ -1,18 +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',\ + :class => 'debug-form form-horizontal',\ :id => 'submit-debug-form'\ } do |f| - .control-group + .control-group.form-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 + .control-group.form-group .controls = text_area_tag :comments, '', :rows => 10, :cols => 80, :placeholder => message_string, :class=> "form-control debug-form" - .control-group.create-btn + .control-group.create-btn.form-group .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 + = button_tag 'Submit', :type => 'submit', :id => 'debug_button', :class => 'btnn 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 => 'btn btn-primary left-margin-10 btn-sm 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/layouts/basic.html.slim b/app/views/layouts/basic.html.slim index 0eb865f5..5c6887bf 100644 --- a/app/views/layouts/basic.html.slim +++ b/app/views/layouts/basic.html.slim @@ -23,7 +23,7 @@ html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] = javascript_include_tag 'application' - amahi_plugins.each do |p| = javascript_include_tag p[:class].underscore - + = javascript_tag {'$.fx.off = true;' if Rails.env.test?} - for header in theme.headers do = header =~ /\.js$/ ? javascript_include_tag(header) : header diff --git a/app/views/layouts/debug.html.slim b/app/views/layouts/debug.html.slim index b1253a24..af512a05 100644 --- a/app/views/layouts/debug.html.slim +++ b/app/views/layouts/debug.html.slim @@ -2,6 +2,7 @@ doctype 5 html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] head meta charset="utf-8" + meta content="width=device-width, initial-scale=1.0" name="viewport" / title = full_page_title = stylesheet_link_tag 'application' @@ -22,7 +23,6 @@ html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] = javascript_include_tag 'application' - amahi_plugins.each do |p| = javascript_include_tag p[:class].underscore - = javascript_tag {'$.fx.off = true;' if Rails.env.test?} - for header in theme.headers do = header =~ /\.js$/ ? javascript_include_tag(header) : header @@ -32,7 +32,7 @@ html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] = csrf_meta_tags - body + body.basic = render 'layouts/header' @@ -41,7 +41,7 @@ html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] = render 'shared/flash_messages' #app.inner #tabs - nav.preftab + nav.preftab.active ul li.active a href='/tab/debug'