smalruby-editor 0.2.6-x86-mingw32 → 0.2.7-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/.rubocop.yml +5 -0
 - data/Guardfile +2 -0
 - data/app/assets/javascripts/blocks/hardware.js.coffee.erb +1 -1
 - data/app/assets/javascripts/fix_blockly.js.erb +0 -50
 - data/app/assets/javascripts/generators/ruby.js.coffee.erb +18 -4
 - data/app/assets/javascripts/models/source_code.js +1 -1
 - data/app/assets/javascripts/msg/en_us.js +1 -0
 - data/app/assets/javascripts/msg/ja.js +4 -0
 - data/app/assets/javascripts/smalruby.js.coffee.erb +50 -6
 - data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +14 -4
 - data/app/assets/javascripts/views/preference_modal_view.js.coffee.erb +71 -0
 - data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +5 -4
 - data/app/assets/stylesheets/application.css +1 -0
 - data/app/assets/stylesheets/preference-modal.css.scss +22 -0
 - data/app/assets/stylesheets/toolbox.css.scss.erb +36 -0
 - data/app/controllers/application_controller.rb +20 -4
 - data/app/controllers/editor_controller.rb +4 -0
 - data/app/controllers/sessions_controller.rb +7 -4
 - data/app/controllers/source_codes_controller.rb +2 -2
 - data/app/controllers/users_controller.rb +22 -0
 - data/app/helpers/application_helper.rb +4 -4
 - data/app/helpers/sessions_helper.rb +0 -0
 - data/app/helpers/users_helper.rb +10 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb +0 -6
 - data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +0 -0
 - data/app/models/preference.rb +71 -0
 - data/app/models/source_code.rb +4 -0
 - data/app/models/user.rb +26 -0
 - data/app/views/editor/_block_tab.html.haml +5 -6
 - data/app/views/editor/_load_modal.html.haml +2 -2
 - data/app/views/editor/_preference_modal.html.haml +16 -0
 - data/app/views/editor/_signin_modal.html.haml +1 -1
 - data/app/views/editor/_toolbox_default.html.haml +86 -79
 - data/app/views/editor/{_toolbox_raspberrypi.html.haml → _toolbox_smalrubot.html.haml} +72 -105
 - data/app/views/editor/_toolbox_smalrubot_s1.html.haml +1 -196
 - data/app/views/editor/_toolbox_smalrubot_v3.html.haml +1 -196
 - data/app/views/editor/index.html.haml +11 -4
 - data/app/views/editor/toolbox.html.haml +1 -0
 - data/app/views/layouts/application.html.erb +1 -1
 - data/app/views/users/preferences.html.haml +34 -0
 - data/config/application.rb +1 -1
 - data/config/locales/en.yml +30 -0
 - data/config/locales/ja.yml +30 -0
 - data/config/routes.rb +4 -57
 - data/db/migrate/20150513061200_create_users.rb +10 -0
 - data/db/migrate/20150513061250_add_index_name_on_users.rb +9 -0
 - data/db/schema.rb +10 -1
 - data/lib/smalruby_editor.rb +22 -24
 - data/lib/smalruby_editor/version.rb +1 -1
 - data/smalruby-editor.gemspec +0 -0
 - data/spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature +2 -0
 - data/spec/acceptance/block_mode/blocks/hardware/init_hardware.feature +1 -0
 - data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +11 -1
 - data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +11 -1
 - data/spec/acceptance/block_mode/blocks/hardware/motor_driver.feature +7 -1
 - data/spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature +2 -0
 - data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/sensor_value.feature +59 -60
 - data/spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature +76 -67
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +9 -11
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_dc_motor_power_ratio.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +9 -10
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +9 -11
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_dc_motor_power_ratio.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_sensor_value.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature +7 -1
 - data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature +2 -0
 - data/spec/acceptance/standalone/preference.feature +92 -0
 - data/{demos → spec/fixtures/files}/hardware_led.rb.xml +0 -0
 - data/spec/javascripts/models/source_code_spec.coffee +0 -0
 - data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_spec.rb +1 -1
 - data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +4 -4
 - data/spec/models/concerns/ruby_to_block_spec.rb +1 -1
 - data/spec/models/source_code_spec.rb +1 -11
 - data/spec/spec_helper.rb +8 -0
 - data/spec/steps/base_steps.rb +68 -16
 - data/spec/steps/standalone_steps.rb +21 -0
 - data/spec/steps/text_editor_steps.rb +8 -8
 - data/spec/support/feature_helper.rb +13 -0
 - data/vendor/assets/javascripts/blockly/blockly_compressed.js +500 -454
 - data/vendor/assets/javascripts/blockly/blocks_compressed.js +29 -28
 - data/vendor/assets/javascripts/blockly/msg/js/ja.js +2 -1
 - metadata +33 -35
 - data/app/assets/stylesheets/toolbox_default.css.scss.erb +0 -34
 - data/app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb +0 -32
 - data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +0 -32
 - data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +0 -32
 - data/demos/adjust_2wd_car.rb.xml +0 -179
 - data/lib/smalruby_editor/config.rb +0 -24
 - data/spec/controllers/editor_controller_spec.rb +0 -12
 - data/spec/controllers/sessions_controller_spec.rb +0 -74
 - data/spec/helpers/sessions_helper_spec.rb +0 -15
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2906e65f6e5a7dd431aab158ba136ee31c42d6b8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c46114528c968865b0e7a2a9f96654bb9d010477
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 73e7359cbff76793fdfb6c664c59ece116d199e48895bd9ac99d502211720a4762fd026eddb3b7865e37ecb54c58b82f9336f7ea8e425fb1d3b61565efdb733c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 45a48cc7f92a847cf82f3d7b109f4d9fdd930f6d7db843dfb5943ac542aa51018f51f24f591afa57d309080749c7f663a18b5e29c260ee19664e8e6f29ad3d29
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -5,6 +5,7 @@ AllCops: 
     | 
|
| 
       5 
5 
     | 
    
         
             
                - spec/fixtures/**
         
     | 
| 
       6 
6 
     | 
    
         
             
                - vendor/*
         
     | 
| 
       7 
7 
     | 
    
         
             
                - work/*
         
     | 
| 
      
 8 
     | 
    
         
            +
              RunRailsCops: true
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            # 日本語でのコメントを許可する
         
     | 
| 
       10 
11 
     | 
    
         
             
            AsciiComments:
         
     | 
| 
         @@ -45,3 +46,7 @@ IfUnlessModifier: 
     | 
|
| 
       45 
46 
     | 
    
         
             
            # this is not important for me.
         
     | 
| 
       46 
47 
     | 
    
         
             
            StringLiterals:
         
     | 
| 
       47 
48 
     | 
    
         
             
              Enabled: false
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            # I think 'unless' is too bad.
         
     | 
| 
      
 51 
     | 
    
         
            +
            FavorUnlessOverNegatedIf:
         
     | 
| 
      
 52 
     | 
    
         
            +
              Enabled: false
         
     | 
    
        data/Guardfile
    CHANGED
    
    | 
         @@ -13,6 +13,8 @@ ignore(TEMPFILE_BY_EMACS) 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
            group :red_green_refactor, halt_on_fail: true do
         
     | 
| 
       15 
15 
     | 
    
         
             
              guard :rubocop, all_on_start: false do
         
     | 
| 
      
 16 
     | 
    
         
            +
                ignore(%r{^db/(?:schema|seeds)\.rb$})
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       16 
18 
     | 
    
         
             
                watch(%r{.+\.rb$})
         
     | 
| 
       17 
19 
     | 
    
         
             
                watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
         
     | 
| 
       18 
20 
     | 
    
         
             
              end
         
     | 
| 
         @@ -36,56 +36,6 @@ Blockly.Toolbox.TreeNode.prototype.onMouseDown = function(e) { 
     | 
|
| 
       36 
36 
     | 
    
         
             
            Blockly.Blocks.math.HUE = <%= SmalrubyEditor::COLORS[:operators] %>;
         
     | 
| 
       37 
37 
     | 
    
         
             
            Blockly.Blocks.texts.HUE = <%= SmalrubyEditor::COLORS[:operators] %>;
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            // blockly/core/field_textinput.js
         
     | 
| 
       40 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.showEditorOrig_ =
         
     | 
| 
       41 
     | 
    
         
            -
              Blockly.FieldTextInput.prototype.showEditor_;
         
     | 
| 
       42 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
         
     | 
| 
       43 
     | 
    
         
            -
              Blockly.FieldTextInput.prototype.showEditorOrig_.apply(this, arguments);
         
     | 
| 
       44 
     | 
    
         
            -
              var htmlInput = Blockly.FieldTextInput.htmlInput_;
         
     | 
| 
       45 
     | 
    
         
            -
              htmlInput.onKeyDownWrapper_ =
         
     | 
| 
       46 
     | 
    
         
            -
                  Blockly.bindEvent_(htmlInput, 'keydown', this, this.onHtmlInputChange2_);
         
     | 
| 
       47 
     | 
    
         
            -
            };
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(e) {
         
     | 
| 
       50 
     | 
    
         
            -
              var htmlInput = Blockly.FieldTextInput.htmlInput_;
         
     | 
| 
       51 
     | 
    
         
            -
              if (e.keyCode != 27) {
         
     | 
| 
       52 
     | 
    
         
            -
                // Update source block.
         
     | 
| 
       53 
     | 
    
         
            -
                var text = htmlInput.value;
         
     | 
| 
       54 
     | 
    
         
            -
                if (text !== htmlInput.oldValue_) {
         
     | 
| 
       55 
     | 
    
         
            -
                  htmlInput.oldValue_ = text;
         
     | 
| 
       56 
     | 
    
         
            -
                  this.setText(text);
         
     | 
| 
       57 
     | 
    
         
            -
                  this.validate_();
         
     | 
| 
       58 
     | 
    
         
            -
                } else if (goog.userAgent.WEBKIT) {
         
     | 
| 
       59 
     | 
    
         
            -
                  // Cursor key.  Render the source block to show the caret moving.
         
     | 
| 
       60 
     | 
    
         
            -
                  // Chrome only (version 26, OS X).
         
     | 
| 
       61 
     | 
    
         
            -
                  this.sourceBlock_.render();
         
     | 
| 
       62 
     | 
    
         
            -
                }
         
     | 
| 
       63 
     | 
    
         
            -
              }
         
     | 
| 
       64 
     | 
    
         
            -
            };
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.onHtmlInputChange2_ = function(e) {
         
     | 
| 
       67 
     | 
    
         
            -
              var htmlInput = Blockly.FieldTextInput.htmlInput_;
         
     | 
| 
       68 
     | 
    
         
            -
              if (e.keyCode == 13) {
         
     | 
| 
       69 
     | 
    
         
            -
                // Enter
         
     | 
| 
       70 
     | 
    
         
            -
                Blockly.WidgetDiv.hide();
         
     | 
| 
       71 
     | 
    
         
            -
              } else if (e.keyCode == 27) {
         
     | 
| 
       72 
     | 
    
         
            -
                // Esc
         
     | 
| 
       73 
     | 
    
         
            -
                this.setText(htmlInput.defaultValue);
         
     | 
| 
       74 
     | 
    
         
            -
                Blockly.WidgetDiv.hide();
         
     | 
| 
       75 
     | 
    
         
            -
              }
         
     | 
| 
       76 
     | 
    
         
            -
            };
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.widgetDisposeOrig_ =
         
     | 
| 
       79 
     | 
    
         
            -
              Blockly.FieldTextInput.prototype.widgetDispose_;
         
     | 
| 
       80 
     | 
    
         
            -
            Blockly.FieldTextInput.prototype.widgetDispose_ = function() {
         
     | 
| 
       81 
     | 
    
         
            -
              var thisField = this;
         
     | 
| 
       82 
     | 
    
         
            -
              return function() {
         
     | 
| 
       83 
     | 
    
         
            -
                Blockly.FieldTextInput.prototype.widgetDisposeOrig_.call(thisField);
         
     | 
| 
       84 
     | 
    
         
            -
                var htmlInput = Blockly.FieldTextInput.htmlInput_;
         
     | 
| 
       85 
     | 
    
         
            -
                Blockly.unbindEvent_(htmlInput.onKeyDownWrapper_);
         
     | 
| 
       86 
     | 
    
         
            -
              };
         
     | 
| 
       87 
     | 
    
         
            -
            };
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
39 
     | 
    
         
             
            // blockly/core/names.js
         
     | 
| 
       90 
40 
     | 
    
         
             
            Blockly.Names.prototype.safeName_ = function(name) {
         
     | 
| 
       91 
41 
     | 
    
         
             
              if (!name) {
         
     | 
| 
         @@ -47,11 +47,11 @@ Blockly.Ruby.init = -> 
     | 
|
| 
       47 
47 
     | 
    
         
             
                else
         
     | 
| 
       48 
48 
     | 
    
         
             
                  @variableDB_.reset()
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                @definitions_[' 
     | 
| 
      
 50 
     | 
    
         
            +
                @definitions_['require__smalruby'] = 'require "smalruby"'
         
     | 
| 
       51 
51 
     | 
    
         
             
                @definitions_['receiver_stack'] = ['main']
         
     | 
| 
       52 
52 
     | 
    
         
             
                @definitions_['character_stack'] = []
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                if Smalruby.isEnabled(' 
     | 
| 
      
 54 
     | 
    
         
            +
                if Smalruby.isEnabled('enabled_auto_init_hardware')
         
     | 
| 
       55 
55 
     | 
    
         
             
                  @definitions_['init_hardware'] = 'init_hardware'
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
            Blockly.Ruby.defineCharacter = (c) ->
         
     | 
| 
         @@ -154,23 +154,31 @@ Blockly.Ruby.characterEvent_ = (block, bodyName, name, arg = null) -> 
     | 
|
| 
       154 
154 
     | 
    
         | 
| 
       155 
155 
     | 
    
         
             
            Blockly.Ruby.finish = (code) ->
         
     | 
| 
       156 
156 
     | 
    
         
             
              requires = []
         
     | 
| 
      
 157 
     | 
    
         
            +
              prepares = []
         
     | 
| 
       157 
158 
     | 
    
         
             
              definitions = []
         
     | 
| 
       158 
159 
     | 
    
         
             
              for name of Blockly.Ruby.definitions_
         
     | 
| 
       159 
160 
     | 
    
         
             
                do (name) ->
         
     | 
| 
       160 
161 
     | 
    
         
             
                  def = Blockly.Ruby.definitions_[name]
         
     | 
| 
       161 
162 
     | 
    
         
             
                  if _.isString(def)
         
     | 
| 
       162 
     | 
    
         
            -
                    if  
     | 
| 
      
 163 
     | 
    
         
            +
                    if name.match(/^require__/)
         
     | 
| 
       163 
164 
     | 
    
         
             
                      requires.push(def)
         
     | 
| 
      
 165 
     | 
    
         
            +
                    else if name.match(/^prepare__/)
         
     | 
| 
      
 166 
     | 
    
         
            +
                      prepares.push(def)
         
     | 
| 
       164 
167 
     | 
    
         
             
                    else
         
     | 
| 
       165 
168 
     | 
    
         
             
                      definitions.push(def)
         
     | 
| 
       166 
169 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
              if definitions.length == 0 && code.length == 0
         
     | 
| 
      
 170 
     | 
    
         
            +
              if prepares.length == 0 && definitions.length == 0 && code.length == 0
         
     | 
| 
       168 
171 
     | 
    
         
             
                return ''
         
     | 
| 
       169 
172 
     | 
    
         | 
| 
       170 
173 
     | 
    
         
             
              allDefs = requires.join('\n') + '\n\n'
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
              if prepares.length > 0
         
     | 
| 
      
 176 
     | 
    
         
            +
                allDefs += prepares.join('\n') + '\n\n'
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
       171 
178 
     | 
    
         
             
              if definitions.length > 0
         
     | 
| 
       172 
179 
     | 
    
         
             
                allDefs += definitions.join('\n')
         
     | 
| 
       173 
180 
     | 
    
         
             
                  .replace(/\n\n+/g, '\n\n').replace(/\n*$/, '\n')
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
       174 
182 
     | 
    
         
             
              allDefs + code
         
     | 
| 
       175 
183 
     | 
    
         | 
| 
       176 
184 
     | 
    
         
             
            Blockly.Ruby.scrubNakedValue = (line) ->
         
     | 
| 
         @@ -213,3 +221,9 @@ Blockly.Ruby.scrub_ = (block, code) -> 
     | 
|
| 
       213 
221 
     | 
    
         
             
              nextBlock = block.nextConnection && block.nextConnection.targetBlock()
         
     | 
| 
       214 
222 
     | 
    
         
             
              nextCode = this.blockToCode(nextBlock)
         
     | 
| 
       215 
223 
     | 
    
         
             
              commentCode + code + nextCode
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
      
 225 
     | 
    
         
            +
            Blockly.Ruby.blockToCode_ = Blockly.Ruby.blockToCode
         
     | 
| 
      
 226 
     | 
    
         
            +
            Blockly.Ruby.blockToCode = (block) ->
         
     | 
| 
      
 227 
     | 
    
         
            +
              if block && !block.disabled && block.type.match(/^hardware_/)
         
     | 
| 
      
 228 
     | 
    
         
            +
                @definitions_['prepare__init_hardware'] = 'init_hardware'
         
     | 
| 
      
 229 
     | 
    
         
            +
              @blockToCode_(block)
         
     | 
| 
         @@ -22,7 +22,7 @@ Smalruby.SourceCode = Backbone.Model.extend({ 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  }
         
     | 
| 
       23 
23 
     | 
    
         
             
                  else {
         
     | 
| 
       24 
24 
     | 
    
         
             
                    if (window.blockMode) {
         
     | 
| 
       25 
     | 
    
         
            -
                      var data = Blockly.Ruby.workspaceToCode();
         
     | 
| 
      
 25 
     | 
    
         
            +
                      var data = Blockly.Ruby.workspaceToCode(Blockly.getMainWorkspace());
         
     | 
| 
       26 
26 
     | 
    
         
             
                    }
         
     | 
| 
       27 
27 
     | 
    
         
             
                    else {
         
     | 
| 
       28 
28 
     | 
    
         
             
                      var data = window.textEditor.getSession().getDocument().getValue();
         
     | 
| 
         @@ -8,6 +8,9 @@ goog.require('Blockly.Msg'); 
     | 
|
| 
       8 
8 
     | 
    
         
             
             * to message files.
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            // fixed original messages
         
     | 
| 
      
 12 
     | 
    
         
            +
            Blockly.Msg.DUPLICATE_BLOCK = "コピー";
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       11 
14 
     | 
    
         
             
            // common
         
     | 
| 
       12 
15 
     | 
    
         
             
            Blockly.Msg.COMMON_TURN_ON = 'オンにする';
         
     | 
| 
       13 
16 
     | 
    
         
             
            Blockly.Msg.COMMON_TURN_OFF = 'オフにする';
         
     | 
| 
         @@ -17,6 +20,7 @@ Blockly.Msg.COMMON_TURN_LEFT = '左に曲げる'; 
     | 
|
| 
       17 
20 
     | 
    
         
             
            Blockly.Msg.COMMON_TURN_RIGHT = '右に曲げる';
         
     | 
| 
       18 
21 
     | 
    
         
             
            Blockly.Msg.COMMON_STOP = '止める';
         
     | 
| 
       19 
22 
     | 
    
         
             
            Blockly.Msg.COMMON_ERROR = 'エラー';
         
     | 
| 
      
 23 
     | 
    
         
            +
            Blockly.Msg.COMMON_PROCESSING = '処理中...';
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
       21 
25 
     | 
    
         | 
| 
       22 
26 
     | 
    
         
             
            // colour name
         
     | 
| 
         @@ -35,7 +35,7 @@ window.Smalruby = 
     | 
|
| 
       35 
35 
     | 
    
         
             
              Collections: {}
         
     | 
| 
       36 
36 
     | 
    
         
             
              Views: {}
         
     | 
| 
       37 
37 
     | 
    
         
             
              Routers: {}
         
     | 
| 
       38 
     | 
    
         
            -
               
     | 
| 
      
 38 
     | 
    
         
            +
              Preferences: {}
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
              username: null
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
         @@ -66,6 +66,8 @@ window.Smalruby = 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  el: $('#load-modal')
         
     | 
| 
       67 
67 
     | 
    
         
             
                @Views.ResetModalView = new Smalruby.ResetModalView
         
     | 
| 
       68 
68 
     | 
    
         
             
                  el: $('#reset-modal')
         
     | 
| 
      
 69 
     | 
    
         
            +
                @Views.PreferenceModalView = new Smalruby.PreferenceModalView
         
     | 
| 
      
 70 
     | 
    
         
            +
                  el: $('#preference-modal')
         
     | 
| 
       69 
71 
     | 
    
         | 
| 
       70 
72 
     | 
    
         
             
                Smalruby.downloading = false
         
     | 
| 
       71 
73 
     | 
    
         
             
                window.onbeforeunload = (event) ->
         
     | 
| 
         @@ -82,10 +84,13 @@ window.Smalruby = 
     | 
|
| 
       82 
84 
     | 
    
         
             
                  path: '/blockly/'
         
     | 
| 
       83 
85 
     | 
    
         
             
                  toolbox: document.getElementById('toolbox')
         
     | 
| 
       84 
86 
     | 
    
         
             
                  trashcan: true
         
     | 
| 
      
 87 
     | 
    
         
            +
                  comments: false
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                @hideEmptyCategory()
         
     | 
| 
       85 
90 
     | 
    
         | 
| 
       86 
91 
     | 
    
         
             
                @blocklyFirst = true
         
     | 
| 
       87 
92 
     | 
    
         
             
                @blocklyLoading = false
         
     | 
| 
       88 
     | 
    
         
            -
                Blockly.addChangeListener =>
         
     | 
| 
      
 93 
     | 
    
         
            +
                Blockly.getMainWorkspace().addChangeListener =>
         
     | 
| 
       89 
94 
     | 
    
         
             
                  Smalruby.changedAfterTranslating = true
         
     | 
| 
       90 
95 
     | 
    
         | 
| 
       91 
96 
     | 
    
         
             
                  # HACK: Blocklyを初期化後に一回だけChangeListenerが呼び出させれ
         
     | 
| 
         @@ -106,7 +111,6 @@ window.Smalruby = 
     | 
|
| 
       106 
111 
     | 
    
         
             
                textEditor.setTheme('ace/theme/clouds')
         
     | 
| 
       107 
112 
     | 
    
         
             
                textEditor.setShowInvisibles(true)
         
     | 
| 
       108 
113 
     | 
    
         
             
                textEditor.gotoLine(0, 0)
         
     | 
| 
       109 
     | 
    
         
            -
                textEditor.setReadOnly(@isEnabled('readonly_ruby_mode'))
         
     | 
| 
       110 
114 
     | 
    
         
             
                textEditor.on 'change', (e) =>
         
     | 
| 
       111 
115 
     | 
    
         
             
                  unless @translating
         
     | 
| 
       112 
116 
     | 
    
         
             
                    window.changed = true
         
     | 
| 
         @@ -195,11 +199,51 @@ window.Smalruby = 
     | 
|
| 
       195 
199 
     | 
    
         
             
                  @Views.CharacterSelectorView.addBlock_(c)
         
     | 
| 
       196 
200 
     | 
    
         
             
                  window.changed = false
         
     | 
| 
       197 
201 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
               
     | 
| 
       199 
     | 
    
         
            -
                @ 
     | 
| 
      
 202 
     | 
    
         
            +
              setPreferences: (preferences) ->
         
     | 
| 
      
 203 
     | 
    
         
            +
                @Preferences = preferences
         
     | 
| 
      
 204 
     | 
    
         
            +
                window.textEditor.setReadOnly(@isEnabled('enabled_readonly_ruby_mode'))
         
     | 
| 
      
 205 
     | 
    
         
            +
                if @isEnabled('disabled_new_character')
         
     | 
| 
      
 206 
     | 
    
         
            +
                  $('#add-character-item').hide()
         
     | 
| 
      
 207 
     | 
    
         
            +
                else
         
     | 
| 
      
 208 
     | 
    
         
            +
                  $('#add-character-item').show()
         
     | 
| 
      
 209 
     | 
    
         
            +
                @changedAfterTranslating = true
         
     | 
| 
      
 210 
     | 
    
         
            +
                @reloadToolbox()
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
              isEnabled: (name) ->
         
     | 
| 
      
 213 
     | 
    
         
            +
                @Preferences[name] == true || @Preferences[name] == 'true' || @Preferences[name] == '1'
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
              reloadToolbox: ->
         
     | 
| 
      
 216 
     | 
    
         
            +
                $('body').block
         
     | 
| 
      
 217 
     | 
    
         
            +
                  message: <%= bm('common.processing') %>
         
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
                unblock = =>
         
     | 
| 
      
 220 
     | 
    
         
            +
                  $('body').unblock()
         
     | 
| 
      
 221 
     | 
    
         
            +
                  null # HACK: if return unblock(), does not call fail().
         
     | 
| 
      
 222 
     | 
    
         
            +
                dfr = $.Deferred()
         
     | 
| 
      
 223 
     | 
    
         
            +
                $.ajax
         
     | 
| 
      
 224 
     | 
    
         
            +
                  url: '/toolbox'
         
     | 
| 
      
 225 
     | 
    
         
            +
                  type: 'GET'
         
     | 
| 
      
 226 
     | 
    
         
            +
                  success: (data, textStatus, jqXHR) -> dfr.resolve(data)
         
     | 
| 
      
 227 
     | 
    
         
            +
                  error: dfr.reject
         
     | 
| 
      
 228 
     | 
    
         
            +
                dfr.promise()
         
     | 
| 
      
 229 
     | 
    
         
            +
                  .then (data) =>
         
     | 
| 
      
 230 
     | 
    
         
            +
                    Blockly.updateToolbox(data)
         
     | 
| 
      
 231 
     | 
    
         
            +
                    @hideEmptyCategory()
         
     | 
| 
      
 232 
     | 
    
         
            +
                  .then(unblock, unblock)
         
     | 
| 
      
 233 
     | 
    
         
            +
                  .fail =>
         
     | 
| 
      
 234 
     | 
    
         
            +
                    errorMessage(<%= bm('.error') %>)
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
              hideEmptyCategory: ->
         
     | 
| 
      
 237 
     | 
    
         
            +
                i = 1
         
     | 
| 
      
 238 
     | 
    
         
            +
                for node in Blockly.getMainWorkspace().options.languageTree.childNodes
         
     | 
| 
      
 239 
     | 
    
         
            +
                  do (node) =>
         
     | 
| 
      
 240 
     | 
    
         
            +
                    if node.tagName
         
     | 
| 
      
 241 
     | 
    
         
            +
                      if node.getElementsByTagName('block').length == 0 && node.getAttribute('custom') == null
         
     | 
| 
      
 242 
     | 
    
         
            +
                        $("div.blocklyTreeRoot > div:nth-child(2) > div:nth-child(#{i})[aria-level=\"1\"]").hide()
         
     | 
| 
      
 243 
     | 
    
         
            +
                      i++
         
     | 
| 
       200 
244 
     | 
    
         | 
| 
       201 
245 
     | 
    
         
             
            $(document).ready ->
         
     | 
| 
       202 
246 
     | 
    
         
             
              Smalruby.initialize()
         
     | 
| 
       203 
247 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
              if Smalruby.username == null && Smalruby.isEnabled(' 
     | 
| 
      
 248 
     | 
    
         
            +
              if Smalruby.username == null && Smalruby.isEnabled('enabled_must_signin')
         
     | 
| 
       205 
249 
     | 
    
         
             
                Smalruby.Views.SigninModalView.render()
         
     | 
| 
         @@ -17,6 +17,7 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       17 
17 
     | 
    
         
             
                'click #save-button': 'onSave'
         
     | 
| 
       18 
18 
     | 
    
         
             
                'click #check-button': 'onCheck'
         
     | 
| 
       19 
19 
     | 
    
         
             
                'click #reset-button': 'onReset'
         
     | 
| 
      
 20 
     | 
    
         
            +
                'click #preference-button': 'onPreference'
         
     | 
| 
       20 
21 
     | 
    
         
             
                'click #signin-button': 'onSignin'
         
     | 
| 
       21 
22 
     | 
    
         
             
                'click #signout-button': 'onSignout'
         
     | 
| 
       22 
23 
     | 
    
         
             
                'click #username-button': 'onUsername'
         
     | 
| 
         @@ -35,6 +36,9 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       35 
36 
     | 
    
         
             
                  done: (e, data) =>
         
     | 
| 
       36 
37 
     | 
    
         
             
                    @load(data.result.source_code)
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
      
 39 
     | 
    
         
            +
                # HACK: if don't do below, can't open submenu on Chromium on Raspberry Pi
         
     | 
| 
      
 40 
     | 
    
         
            +
                $('.dropdown-toggle').dropdown()
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       38 
42 
     | 
    
         
             
              onBlockMode: (e) ->
         
     | 
| 
       39 
43 
     | 
    
         
             
                e.preventDefault()
         
     | 
| 
       40 
44 
     | 
    
         | 
| 
         @@ -78,7 +82,7 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       78 
82 
     | 
    
         | 
| 
       79 
83 
     | 
    
         
             
                return unless Smalruby.changedAfterTranslating
         
     | 
| 
       80 
84 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                data = Blockly.Ruby.workspaceToCode()
         
     | 
| 
      
 85 
     | 
    
         
            +
                data = Blockly.Ruby.workspaceToCode(Blockly.getMainWorkspace())
         
     | 
| 
       82 
86 
     | 
    
         
             
                Smalruby.translating = true
         
     | 
| 
       83 
87 
     | 
    
         
             
                window.textEditor.getSession().getDocument().setValue(data)
         
     | 
| 
       84 
88 
     | 
    
         
             
                Smalruby.translating = false
         
     | 
| 
         @@ -256,6 +260,11 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       256 
260 
     | 
    
         
             
                  Smalruby.reset()
         
     | 
| 
       257 
261 
     | 
    
         
             
                true
         
     | 
| 
       258 
262 
     | 
    
         | 
| 
      
 263 
     | 
    
         
            +
              onPreference: (e) ->
         
     | 
| 
      
 264 
     | 
    
         
            +
                e.preventDefault()
         
     | 
| 
      
 265 
     | 
    
         
            +
             
     | 
| 
      
 266 
     | 
    
         
            +
                Smalruby.Views.PreferenceModalView.render()
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
       259 
268 
     | 
    
         
             
              onSignin: (e) ->
         
     | 
| 
       260 
269 
     | 
    
         
             
                e.preventDefault()
         
     | 
| 
       261 
270 
     | 
    
         | 
| 
         @@ -270,14 +279,15 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       270 
279 
     | 
    
         
             
                })
         
     | 
| 
       271 
280 
     | 
    
         
             
                  .then(
         
     | 
| 
       272 
281 
     | 
    
         
             
                    (data) ->
         
     | 
| 
      
 282 
     | 
    
         
            +
                      Smalruby.setPreferences(data)
         
     | 
| 
       273 
283 
     | 
    
         
             
                      Smalruby.username = null
         
     | 
| 
       274 
284 
     | 
    
         
             
                      $('#signin-button').show()
         
     | 
| 
       275 
     | 
    
         
            -
                      $(' 
     | 
| 
      
 285 
     | 
    
         
            +
                      $('.signed-in-menu').hide()
         
     | 
| 
       276 
286 
     | 
    
         
             
                      $('#username-label').text('')
         
     | 
| 
       277 
287 
     | 
    
         
             
                      $('#username-button').hide()
         
     | 
| 
       278 
288 
     | 
    
         
             
                      successMessage(<%= bm('.signout_succeeded') %>)
         
     | 
| 
       279 
289 
     | 
    
         | 
| 
       280 
     | 
    
         
            -
                      if Smalruby.isEnabled(' 
     | 
| 
      
 290 
     | 
    
         
            +
                      if Smalruby.isEnabled('enabled_must_signin')
         
     | 
| 
       281 
291 
     | 
    
         
             
                        Smalruby.Views.SigninModalView.render()
         
     | 
| 
       282 
292 
     | 
    
         
             
                    ->
         
     | 
| 
       283 
293 
     | 
    
         
             
                      errorMessage(<%= bm('.signout_error') %>)
         
     | 
| 
         @@ -364,7 +374,7 @@ Smalruby.MainMenuView = Backbone.View.extend 
     | 
|
| 
       364 
374 
     | 
    
         
             
                    filename = filename.replace(/(\.rb)?\.xml$/, '.rb')
         
     | 
| 
       365 
375 
     | 
    
         
             
                    Smalruby.blocklyLoading = true
         
     | 
| 
       366 
376 
     | 
    
         
             
                    Smalruby.loadXml(info.data)
         
     | 
| 
       367 
     | 
    
         
            -
                    info.data = Blockly.Ruby.workspaceToCode()
         
     | 
| 
      
 377 
     | 
    
         
            +
                    info.data = Blockly.Ruby.workspaceToCode(Blockly.getMainWorkspace())
         
     | 
| 
       368 
378 
     | 
    
         
             
                  else
         
     | 
| 
       369 
379 
     | 
    
         
             
                    Smalruby.Collections.CharacterSet.reset()
         
     | 
| 
       370 
380 
     | 
    
         
             
                    Blockly.mainWorkspace.clear()
         
     | 
| 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <%
         
     | 
| 
      
 2 
     | 
    
         
            +
              require 'smalruby_editor'
         
     | 
| 
      
 3 
     | 
    
         
            +
              require 'smalruby_editor/blockly_message_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
            %>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # preference dialog view
         
     | 
| 
      
 7 
     | 
    
         
            +
            Smalruby.PreferenceModalView = Backbone.View.extend
         
     | 
| 
      
 8 
     | 
    
         
            +
              events:
         
     | 
| 
      
 9 
     | 
    
         
            +
                'click #preference-modal-ok-button': 'onOk'
         
     | 
| 
      
 10 
     | 
    
         
            +
                'change #user_preferences_toolbox_name': 'renderToolboxPreferences'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              #initialize: ->
         
     | 
| 
      
 13 
     | 
    
         
            +
              #  # no-op
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              render: ->
         
     | 
| 
      
 16 
     | 
    
         
            +
                @$el.find('.modal-body').block
         
     | 
| 
      
 17 
     | 
    
         
            +
                  message: null
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                unblock = =>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @$el.find('.modal-body').unblock()
         
     | 
| 
      
 21 
     | 
    
         
            +
                  null # HACK: if return unblock(), does not call fail().
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                @$el.modal
         
     | 
| 
      
 24 
     | 
    
         
            +
                  backdrop: 'static'
         
     | 
| 
      
 25 
     | 
    
         
            +
                @$el.modal('show')
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                dfr = $.Deferred()
         
     | 
| 
      
 28 
     | 
    
         
            +
                $.ajax
         
     | 
| 
      
 29 
     | 
    
         
            +
                  url: 'preferences'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  type: 'GET'
         
     | 
| 
      
 31 
     | 
    
         
            +
                  cache: false
         
     | 
| 
      
 32 
     | 
    
         
            +
                  success: (data, textStatus, jqXHR) -> dfr.resolve(data)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  error: dfr.reject
         
     | 
| 
      
 34 
     | 
    
         
            +
                dfr.promise()
         
     | 
| 
      
 35 
     | 
    
         
            +
                  .then (data) =>
         
     | 
| 
      
 36 
     | 
    
         
            +
                    $('#preference-modal-content').replaceWith(data)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @renderToolboxPreferences()
         
     | 
| 
      
 38 
     | 
    
         
            +
                  .then(unblock, unblock)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  .fail =>
         
     | 
| 
      
 40 
     | 
    
         
            +
                    @$el.modal('hide')
         
     | 
| 
      
 41 
     | 
    
         
            +
                    errorMessage(<%= bm('.error') %>)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              onOk: ->
         
     | 
| 
      
 44 
     | 
    
         
            +
                @$el.block
         
     | 
| 
      
 45 
     | 
    
         
            +
                  message: <%= bm('common.processing') %>
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                unblock = =>
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @$el.unblock()
         
     | 
| 
      
 49 
     | 
    
         
            +
                  null # HACK: if return unblock(), does not call fail().
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                form = @$el.find('form')
         
     | 
| 
      
 52 
     | 
    
         
            +
                dfr = $.Deferred()
         
     | 
| 
      
 53 
     | 
    
         
            +
                $.ajax
         
     | 
| 
      
 54 
     | 
    
         
            +
                  url: form.attr('action')
         
     | 
| 
      
 55 
     | 
    
         
            +
                  data: form.serialize()
         
     | 
| 
      
 56 
     | 
    
         
            +
                  type: 'POST'
         
     | 
| 
      
 57 
     | 
    
         
            +
                  success: (data, textStatus, jqXHR) -> dfr.resolve(data)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  error: dfr.reject
         
     | 
| 
      
 59 
     | 
    
         
            +
                dfr.promise()
         
     | 
| 
      
 60 
     | 
    
         
            +
                  .then (data) =>
         
     | 
| 
      
 61 
     | 
    
         
            +
                    Smalruby.setPreferences(data)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  .then(unblock, unblock)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  .done =>
         
     | 
| 
      
 64 
     | 
    
         
            +
                    @$el.modal('hide')
         
     | 
| 
      
 65 
     | 
    
         
            +
                  .fail =>
         
     | 
| 
      
 66 
     | 
    
         
            +
                    errorMessage(<%= bm('.error') %>)
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              renderToolboxPreferences: ->
         
     | 
| 
      
 69 
     | 
    
         
            +
                @$el.find('.toolbox_preferences').hide()
         
     | 
| 
      
 70 
     | 
    
         
            +
                toolboxName = $('#user_preferences_toolbox_name').val() || 'default'
         
     | 
| 
      
 71 
     | 
    
         
            +
                @$el.find(".toolbox_preferences.#{toolboxName}").show()
         
     | 
| 
         @@ -27,10 +27,11 @@ Smalruby.SigninModalView = Backbone.View.extend 
     | 
|
| 
       27 
27 
     | 
    
         
             
                  $.post('/sessions/', { username: username })
         
     | 
| 
       28 
28 
     | 
    
         
             
                    .then(
         
     | 
| 
       29 
29 
     | 
    
         
             
                      (data) ->
         
     | 
| 
       30 
     | 
    
         
            -
                        Smalruby. 
     | 
| 
      
 30 
     | 
    
         
            +
                        Smalruby.setPreferences(data)
         
     | 
| 
      
 31 
     | 
    
         
            +
                        Smalruby.username = username
         
     | 
| 
       31 
32 
     | 
    
         
             
                        $('#signin-button').hide()
         
     | 
| 
       32 
     | 
    
         
            -
                        $(' 
     | 
| 
       33 
     | 
    
         
            -
                        $('#username-label').text( 
     | 
| 
      
 33 
     | 
    
         
            +
                        $('.signed-in-menu').show()
         
     | 
| 
      
 34 
     | 
    
         
            +
                        $('#username-label').text(username)
         
     | 
| 
       34 
35 
     | 
    
         
             
                        $('#username-button').show()
         
     | 
| 
       35 
36 
     | 
    
         
             
                        successMessage(<%= bm('.signed_in') %>)
         
     | 
| 
       36 
37 
     | 
    
         
             
                        new $.Deferred().resolve().promise()
         
     | 
| 
         @@ -39,5 +40,5 @@ Smalruby.SigninModalView = Backbone.View.extend 
     | 
|
| 
       39 
40 
     | 
    
         
             
                        new $.Deferred().resolve().promise()
         
     | 
| 
       40 
41 
     | 
    
         
             
                    )
         
     | 
| 
       41 
42 
     | 
    
         
             
                    .done =>
         
     | 
| 
       42 
     | 
    
         
            -
                      if Smalruby.username != null || !Smalruby.isEnabled(' 
     | 
| 
      
 43 
     | 
    
         
            +
                      if Smalruby.username != null || !Smalruby.isEnabled('enabled_must_signin')
         
     | 
| 
       43 
44 
     | 
    
         
             
                        @$el.modal('hide')
         
     |