mindapp 0.0.1 → 0.0.2
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.
- data/README.md +19 -3
- data/lib/generators/mindapp/install_generator.rb +2 -1
- data/lib/generators/mindapp/templates/app/assets/javascripts/admins.js.coffee +3 -0
- data/lib/generators/mindapp/templates/app/assets/javascripts/devs.js.coffee +3 -0
- data/lib/generators/mindapp/templates/app/assets/javascripts/disable_enter_key.js +1 -1
- data/lib/generators/mindapp/templates/app/assets/javascripts/mindapp.js +2 -2
- data/lib/generators/mindapp/templates/app/assets/javascripts/users.js.coffee +3 -0
- data/lib/generators/mindapp/templates/app/assets/stylesheets/admins.css.scss +3 -0
- data/lib/generators/mindapp/templates/app/assets/stylesheets/devs.css.scss +3 -0
- data/lib/generators/mindapp/templates/app/assets/stylesheets/users.css.scss +3 -0
- data/lib/generators/mindapp/templates/app/controllers/admins_controller.rb +6 -0
- data/lib/generators/mindapp/templates/app/controllers/devs_controller.rb +2 -0
- data/lib/generators/mindapp/templates/app/controllers/mindapp_controller.rb +23 -18
- data/lib/generators/mindapp/templates/app/controllers/sessions_controller.rb +1 -1
- data/lib/generators/mindapp/templates/app/controllers/users_controller.rb +25 -0
- data/lib/generators/mindapp/templates/app/helpers/admins_helper.rb +2 -0
- data/lib/generators/mindapp/templates/app/helpers/devs_helper.rb +2 -0
- data/lib/generators/mindapp/templates/app/helpers/users_helper.rb +2 -0
- data/lib/generators/mindapp/templates/app/mindapp/index.mm +5 -6
- data/lib/generators/mindapp/templates/app/mindapp/template/view.html.erb +9 -9
- data/lib/generators/mindapp/templates/app/models/mindapp/doc.rb +4 -3
- data/lib/generators/mindapp/templates/app/models/mindapp/module.rb +1 -0
- data/lib/generators/mindapp/templates/app/models/mindapp/notice.rb +1 -0
- data/lib/generators/mindapp/templates/app/models/mindapp/role.rb +1 -0
- data/lib/generators/mindapp/templates/app/models/mindapp/service.rb +1 -0
- data/lib/generators/mindapp/templates/app/models/param.rb +2 -2
- data/lib/generators/mindapp/templates/app/views/admins/edit_role/edit_role.html.erb +7 -0
- data/lib/generators/mindapp/templates/app/views/admins/edit_role/select_user.html.erb +4 -0
- data/lib/generators/mindapp/templates/app/views/layouts/_full.haml +1 -1
- data/lib/generators/mindapp/templates/app/views/mindapp/_menu.haml +1 -1
- data/lib/generators/mindapp/templates/app/views/mindapp/_menu_mm.haml +2 -3
- data/lib/generators/mindapp/templates/app/views/mindapp/_pending_page.haml +1 -2
- data/lib/generators/mindapp/templates/app/views/mindapp/error_logs.haml +22 -0
- data/lib/generators/mindapp/templates/app/views/mindapp/logs.haml +22 -0
- data/lib/generators/mindapp/templates/app/views/mindapp/run_form.haml +1 -1
- data/lib/generators/mindapp/templates/app/views/mindapp/search.haml +1 -1
- data/lib/generators/mindapp/templates/app/views/mindapp/status.haml +2 -2
- data/lib/generators/mindapp/templates/app/views/users/index.haml +13 -0
- data/lib/generators/mindapp/templates/app/views/users/pwd/enter.html.erb +6 -0
- data/lib/generators/mindapp/templates/app/views/users/user/enter_user.html.erb +8 -0
- data/lib/generators/mindapp/templates/spec/controllers/admins_controller_spec.rb +5 -0
- data/lib/generators/mindapp/templates/spec/controllers/devs_controller_spec.rb +5 -0
- data/lib/generators/mindapp/templates/spec/controllers/users_controller_spec.rb +5 -0
- data/lib/generators/mindapp/templates/spec/helpers/admins_helper_spec.rb +15 -0
- data/lib/generators/mindapp/templates/spec/helpers/devs_helper_spec.rb +15 -0
- data/lib/generators/mindapp/templates/spec/helpers/users_helper_spec.rb +15 -0
- data/lib/generators/mindapp/templates/spec/spec_helper.rb +38 -0
- data/lib/mindapp/helpers.rb +15 -12
- data/lib/mindapp/version.rb +1 -1
- data/mindapp.gemspec +3 -3
- metadata +31 -6
- data/lib/generators/mindapp/templates/app/mailers/.gitkeep +0 -0
    
        data/README.md
    CHANGED
    
    | @@ -1,6 +1,17 @@ | |
| 1 1 | 
             
            # Mindapp
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            gem to generate ror app from mind map
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Warning
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * under heavy development, not ready yet
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## Convention
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            * database is MongoDB
         | 
| 12 | 
            +
            * images stored in or Cloudinary (default) unset IMAGE_LOCATION in initializer/mindapp.rb to use file system
         | 
| 13 | 
            +
            * mail use Gmail SMTP
         | 
| 14 | 
            +
            * authentication use omniauth-identity
         | 
| 4 15 |  | 
| 5 16 | 
             
            ## Installation
         | 
| 6 17 |  | 
| @@ -12,9 +23,14 @@ And then execute: | |
| 12 23 |  | 
| 13 24 | 
             
                $ bundle
         | 
| 14 25 |  | 
| 15 | 
            -
             | 
| 26 | 
            +
            Then generate and seed, which will create initial user admin:secret
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                $ rails generate mindapp:install
         | 
| 29 | 
            +
                $ rake db:seed
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            Your app is now ready at http://localhost:3000/. When make changes to app/mindapp/index.mm, run
         | 
| 16 32 |  | 
| 17 | 
            -
                $  | 
| 33 | 
            +
                $ rake mindapp:update
         | 
| 18 34 |  | 
| 19 35 | 
             
            ## Usage
         | 
| 20 36 |  | 
| @@ -19,6 +19,7 @@ module Mindapp | |
| 19 19 | 
             
                    gem 'bcrypt-ruby', '~> 3.0.0'
         | 
| 20 20 | 
             
                    gem 'omniauth-identity'
         | 
| 21 21 | 
             
                    gem 'cloudinary'
         | 
| 22 | 
            +
                    gem 'kaminari'
         | 
| 22 23 | 
             
                    gem_group :development, :test do
         | 
| 23 24 | 
             
                      gem "debugger"
         | 
| 24 25 | 
             
                      gem "rspec"
         | 
| @@ -73,7 +74,7 @@ module Mindapp | |
| 73 74 | 
             
                    end
         | 
| 74 75 | 
             
                    initializer "mindapp.rb" do
         | 
| 75 76 | 
             
            %q{# encoding: utf-8
         | 
| 76 | 
            -
             | 
| 77 | 
            +
            MM = "#{Rails.root}/app/mindapp/index.mm"
         | 
| 77 78 | 
             
            DEFAULT_TITLE = 'Mindapp'
         | 
| 78 79 | 
             
            DEFAULT_HEADER = 'Mindapp'
         | 
| 79 80 | 
             
            GMAP = true
         | 
| @@ -3,7 +3,7 @@ $(function() { | |
| 3 3 | 
             
                //Deterime where our character code is coming from within the event
         | 
| 4 4 | 
             
                var charCode = evt.charCode || evt.keyCode;
         | 
| 5 5 | 
             
                if (charCode  == 13) { //Enter key's keycode
         | 
| 6 | 
            -
                  alert(" | 
| 6 | 
            +
                  alert("Please click the button");
         | 
| 7 7 | 
             
                  return false;
         | 
| 8 8 | 
             
                }
         | 
| 9 9 | 
             
              });
         | 
| @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            $(function() {
         | 
| 2 2 | 
             
              $('body').show();
         | 
| 3 3 | 
             
              $.extend(  $.mobile , {
         | 
| 4 | 
            -
                loadingMessage: ' | 
| 5 | 
            -
                pageLoadErrorMessage: " | 
| 4 | 
            +
                loadingMessage: 'please wait',
         | 
| 5 | 
            +
                pageLoadErrorMessage: "Error"
         | 
| 6 6 | 
             
              });
         | 
| 7 7 |  | 
| 8 8 | 
             
              // TODO loop all $('.ui-header .ui-btn-text')
         | 
| @@ -2,6 +2,12 @@ | |
| 2 2 | 
             
            class MindappController < ApplicationController
         | 
| 3 3 | 
             
              def index
         | 
| 4 4 | 
             
              end
         | 
| 5 | 
            +
              def logs
         | 
| 6 | 
            +
                @xmains = Mindapp::Xmain.all.desc(:created_at).page(params[:page]).per(10)
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
              def error_logs
         | 
| 9 | 
            +
                @xmains = Mindapp::Xmain.in(status:['E']).desc(:created_at).page(params[:page]).per(10)
         | 
| 10 | 
            +
              end
         | 
| 5 11 | 
             
              def pending
         | 
| 6 12 | 
             
                @xmains = Mindapp::Xmain.in(status:['R','I']).asc(:created_at)
         | 
| 7 13 | 
             
              end
         | 
| @@ -27,22 +33,23 @@ class MindappController < ApplicationController | |
| 27 33 | 
             
                render :text=> "<script>#{js}</script>"
         | 
| 28 34 | 
             
              end
         | 
| 29 35 | 
             
              def init
         | 
| 30 | 
            -
                 | 
| 36 | 
            +
                module_code, code = params[:s].split(":")
         | 
| 37 | 
            +
                @service= Mindapp::Service.where(:module_code=> module_code, :code=> code).first
         | 
| 38 | 
            +
                # @service= Mindapp::Service.where(:module_code=> params[:module], :code=> params[:service]).first
         | 
| 31 39 | 
             
                if @service && authorize_init?
         | 
| 32 40 | 
             
                  xmain = create_xmain(@service)
         | 
| 33 41 | 
             
                  result = create_runseq(xmain)
         | 
| 34 42 | 
             
                  unless result
         | 
| 35 43 | 
             
                    message = "cannot find action for xmain #{xmain.id}"
         | 
| 36 | 
            -
                     | 
| 44 | 
            +
                    ma_log("ERROR", message)
         | 
| 37 45 | 
             
                    flash[:notice]= message
         | 
| 38 | 
            -
                    # gma_notice message
         | 
| 39 46 | 
             
                    redirect_to "pending" and return
         | 
| 40 47 | 
             
                  end
         | 
| 41 48 | 
             
                  xmain.update_attribute(:xvars, @xvars)
         | 
| 42 49 | 
             
                  xmain.runseqs.last.update_attribute(:end,true)
         | 
| 43 50 | 
             
                  redirect_to :action=>'run', :id=>xmain.id
         | 
| 44 51 | 
             
                else
         | 
| 45 | 
            -
                  refresh_to "/", :alert => " | 
| 52 | 
            +
                  refresh_to "/", :alert => "Error: cannot process"
         | 
| 46 53 | 
             
                end
         | 
| 47 54 | 
             
              end
         | 
| 48 55 | 
             
              def run
         | 
| @@ -68,8 +75,8 @@ class MindappController < ApplicationController | |
| 68 75 | 
             
                      f= "app/views/#{service.module.code}/#{service.code}/#{@runseq.code}.html.erb"
         | 
| 69 76 | 
             
                      @ui= File.read(f)
         | 
| 70 77 | 
             
                    else
         | 
| 71 | 
            -
                      flash[:notice]= "ไม่สามารถค้นหาบริการที่ต้องการได้"
         | 
| 72 | 
            -
                       | 
| 78 | 
            +
                      # flash[:notice]= "ไม่สามารถค้นหาบริการที่ต้องการได้"
         | 
| 79 | 
            +
                      ma_log "Error: Service not found"
         | 
| 73 80 | 
             
                      redirect_to_root
         | 
| 74 81 | 
             
                    end
         | 
| 75 82 | 
             
                  end
         | 
| @@ -160,8 +167,8 @@ class MindappController < ApplicationController | |
| 160 167 | 
             
                  @message = "สิ้นสุดการทำงาน" if @runseq.end
         | 
| 161 168 | 
             
                  eval "@xvars[@runseq.code] = url_for(:controller=>'Mindapp', :action=>'document', :id=>@doc.id)"
         | 
| 162 169 | 
             
                else
         | 
| 163 | 
            -
                  flash[:notice]= "ไม่สามารถค้นหาบริการที่ต้องการได้"
         | 
| 164 | 
            -
                   | 
| 170 | 
            +
                  # flash[:notice]= "ไม่สามารถค้นหาบริการที่ต้องการได้"
         | 
| 171 | 
            +
                  ma_log "Error: service not found"
         | 
| 165 172 | 
             
                  redirect_to_root
         | 
| 166 173 | 
             
                end
         | 
| 167 174 | 
             
                #display= get_option("display")
         | 
| @@ -315,7 +322,7 @@ class MindappController < ApplicationController | |
| 315 322 | 
             
                @backbtn= true
         | 
| 316 323 | 
             
                @xvars= @xmain.xvars
         | 
| 317 324 | 
             
                # flash.now[:notice]= "รายการ #{@xmain.id} ได้ถูกยกเลิกแล้ว" if @xmain.status=='X'
         | 
| 318 | 
            -
                 | 
| 325 | 
            +
                ma_log "Task #{@xmain.id} is cancelled" if @xmain.status=='X'
         | 
| 319 326 | 
             
                # flash.now[:notice]= "transaction #{@xmain.id} was cancelled" if @xmain.status=='X'
         | 
| 320 327 | 
             
              rescue
         | 
| 321 328 | 
             
                refresh_to "/", :alert => "Could not find task number <b> #{params[:xid]} </b>"
         | 
| @@ -323,7 +330,7 @@ class MindappController < ApplicationController | |
| 323 330 | 
             
              def help
         | 
| 324 331 | 
             
              end
         | 
| 325 332 | 
             
              def search
         | 
| 326 | 
            -
                @q = params[:q] || params[: | 
| 333 | 
            +
                @q = params[:q] || params[:ma_search][:q] || ""
         | 
| 327 334 | 
             
                @title = "ผลการค้นหา #{@q}"
         | 
| 328 335 | 
             
                @backbtn= true
         | 
| 329 336 | 
             
                @cache= true
         | 
| @@ -335,17 +342,15 @@ class MindappController < ApplicationController | |
| 335 342 | 
             
                end
         | 
| 336 343 | 
             
              end
         | 
| 337 344 | 
             
              def err404
         | 
| 338 | 
            -
                 | 
| 345 | 
            +
                # ma_log 'ERROR', 'main/err404'
         | 
| 339 346 | 
             
                flash[:notice] = "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
         | 
| 340 | 
            -
                 | 
| 341 | 
            -
                # gma_notice "ขออภัย เกิดข้อผิดพลาดรหัส 404 ขึ้นในระบบ กรุณาติดต่อผู้ดูแลระบบ"
         | 
| 347 | 
            +
                ma_log "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
         | 
| 342 348 | 
             
                redirect_to '/'
         | 
| 343 349 | 
             
              end
         | 
| 344 350 | 
             
              def err500
         | 
| 345 | 
            -
                 | 
| 351 | 
            +
                # ma_log 'ERROR', 'main/err500'
         | 
| 346 352 | 
             
                flash[:notice] = "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
         | 
| 347 | 
            -
                 | 
| 348 | 
            -
                # gma_notice "ขออภัย เกิดข้อผิดพลาดรหัส 500 ขึ้นในระบบ กรุณาติดต่อผู้ดูแลระบบ"
         | 
| 353 | 
            +
                ma_log "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
         | 
| 349 354 | 
             
                redirect_to '/'
         | 
| 350 355 | 
             
              end
         | 
| 351 356 |  | 
| @@ -374,7 +379,7 @@ class MindappController < ApplicationController | |
| 374 379 | 
             
                i= 0; j= 0 # i= step, j= form_step
         | 
| 375 380 | 
             
                root.elements.each('node') do |activity|
         | 
| 376 381 | 
             
                  text= activity.attributes['TEXT']
         | 
| 377 | 
            -
                  next if  | 
| 382 | 
            +
                  next if ma_comment?(text)
         | 
| 378 383 | 
             
                  next if text =~/^rule:\s*/
         | 
| 379 384 | 
             
                  action= freemind2action(activity.elements['icon'].attributes['BUILTIN']) if activity.elements['icon']
         | 
| 380 385 | 
             
                  return false unless action
         | 
| @@ -458,7 +463,7 @@ class MindappController < ApplicationController | |
| 458 463 | 
             
                else
         | 
| 459 464 | 
             
                  @docs = GmaDoc.search(@q.downcase, params[:page], PER_PAGE)
         | 
| 460 465 | 
             
                end
         | 
| 461 | 
            -
                @xmains = GmaXmain.find(@docs.map(&: | 
| 466 | 
            +
                @xmains = GmaXmain.find(@docs.map(&:ma_xmain_id)).sort { |a,b| b.id<=>a.id }
         | 
| 462 467 | 
             
                # @xmains = GmaXmain.find @docs.map(&:created_at).sort { |a,b| b<=>a }
         | 
| 463 468 | 
             
              end
         | 
| 464 469 | 
             
            end
         | 
| @@ -22,7 +22,7 @@ class SessionsController < ApplicationController | |
| 22 22 | 
             
              end
         | 
| 23 23 |  | 
| 24 24 | 
             
              def failure
         | 
| 25 | 
            -
                 | 
| 25 | 
            +
                ma_log "Authentication failed, please try again."
         | 
| 26 26 | 
             
                redirect_to root_path, :alert=> "Authentication failed, please try again."
         | 
| 27 27 | 
             
              end
         | 
| 28 28 | 
             
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            # -*- encoding : utf-8 -*-
         | 
| 2 | 
            +
            class UsersController < ApplicationController
         | 
| 3 | 
            +
              def index
         | 
| 4 | 
            +
                @today = Date.today
         | 
| 5 | 
            +
                @xmains = current_user.xmains.in(status:['R','I']).asc(:created_at)
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              # mindapp methods
         | 
| 9 | 
            +
              def update_user
         | 
| 10 | 
            +
                # can't use session, current_user inside mindapp methods
         | 
| 11 | 
            +
                $user.update_attribute :email, $xvars["enter_user"]["user"]["email"]
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
              def change_password
         | 
| 14 | 
            +
                # check if old password correct
         | 
| 15 | 
            +
                identity = Identity.find_by :code=> $user.code
         | 
| 16 | 
            +
                if identity.authenticate($xvars["enter"]["epass"])
         | 
| 17 | 
            +
                  identity.password = $xvars["enter"]["npass"]
         | 
| 18 | 
            +
                  identity.password_confirmation = $xvars["enter"]["npass_confirm"]
         | 
| 19 | 
            +
                  identity.save
         | 
| 20 | 
            +
                  ma_log "Password changed"
         | 
| 21 | 
            +
                else
         | 
| 22 | 
            +
                  ma_log "Unauthorized access"
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| @@ -2,9 +2,9 @@ | |
| 2 2 | 
             
            <!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
         | 
| 3 3 | 
             
            <node CREATED="1273819432637" ID="ID_1098419600" MODIFIED="1334737006485" TEXT="Mindapp">
         | 
| 4 4 | 
             
            <node CREATED="1273819462973" ID="ID_282419531" MODIFIED="1334737064016" POSITION="right" TEXT="services">
         | 
| 5 | 
            -
            <node CREATED="1275756501221" FOLDED="true" ID="ID_1720745721" MODIFIED=" | 
| 5 | 
            +
            <node CREATED="1275756501221" FOLDED="true" ID="ID_1720745721" MODIFIED="1359019893815" TEXT="users:user">
         | 
| 6 6 | 
             
            <node CREATED="1278491598711" ID="ID_1662699954" MODIFIED="1278491602025" TEXT="role:m"/>
         | 
| 7 | 
            -
            <node CREATED="1279700865182" ID="ID_1266797279" MODIFIED=" | 
| 7 | 
            +
            <node CREATED="1279700865182" ID="ID_1266797279" MODIFIED="1357798847781" TEXT="link:info: /users"/>
         | 
| 8 8 | 
             
            <node CREATED="1319015338880" ID="ID_189841353" MODIFIED="1330477824203" TEXT="link:pending tasks: /mindapp/pending"/>
         | 
| 9 9 | 
             
            <node CREATED="1275905802131" ID="ID_154000410" MODIFIED="1355422418892" TEXT="user:edit">
         | 
| 10 10 | 
             
            <node CREATED="1275756515843" ID="ID_1108188320" MODIFIED="1330477833918" TEXT="enter_user:edit">
         | 
| @@ -26,9 +26,8 @@ | |
| 26 26 | 
             
            </node>
         | 
| 27 27 | 
             
            <node CREATED="1276062721100" ID="ID_1806588076" MODIFIED="1276062727685" TEXT="rule: login?"/>
         | 
| 28 28 | 
             
            </node>
         | 
| 29 | 
            -
            <node CREATED="1279700865182" ID="ID_630918549" MODIFIED="1330477858086" TEXT="link:document: /main/doc"/>
         | 
| 30 29 | 
             
            </node>
         | 
| 31 | 
            -
            <node CREATED="1275752678377" FOLDED="true" ID="ID_1348489452" MODIFIED=" | 
| 30 | 
            +
            <node CREATED="1275752678377" FOLDED="true" ID="ID_1348489452" MODIFIED="1359019899148" TEXT="admins:admin">
         | 
| 32 31 | 
             
            <node CREATED="1275752688167" ID="ID_229996461" MODIFIED="1275752690948" TEXT="role:a"/>
         | 
| 33 32 | 
             
            <node CREATED="1282722836614" ID="ID_1213363124" MODIFIED="1330477902602" TEXT="edit_role:edit user role">
         | 
| 34 33 | 
             
            <node CREATED="1282722862918" ID="ID_1190117882" MODIFIED="1330477922159" TEXT="select_user:select user">
         | 
| @@ -46,9 +45,9 @@ | |
| 46 45 | 
             
            <node CREATED="1273913393454" ID="ID_1088166839" MODIFIED="1355422465435" TEXT="link: pending tasks: /mindapp/pending"/>
         | 
| 47 46 | 
             
            <node CREATED="1275790679363" ID="ID_829325467" MODIFIED="1355422470135" TEXT="link: logs: /mindapp/logs"/>
         | 
| 48 47 | 
             
            </node>
         | 
| 49 | 
            -
            <node CREATED="1273706796854"  | 
| 48 | 
            +
            <node CREATED="1273706796854" ID="ID_1003882979" MODIFIED="1359019900806" TEXT="devs: developer">
         | 
| 50 49 | 
             
            <node CREATED="1275373154914" ID="ID_340725299" MODIFIED="1275373158632" TEXT="role:d"/>
         | 
| 51 | 
            -
            <node CREATED="1275788317299" ID="ID_716276608" MODIFIED=" | 
| 50 | 
            +
            <node CREATED="1275788317299" ID="ID_716276608" MODIFIED="1359019912446" TEXT="link: error_logs: /mindapp/error_logs"/>
         | 
| 52 51 | 
             
            </node>
         | 
| 53 52 | 
             
            </node>
         | 
| 54 53 | 
             
            <node CREATED="1273819465949" ID="ID_855471610" MODIFIED="1355422517520" POSITION="right" TEXT="roles">
         | 
| @@ -2,20 +2,20 @@ | |
| 2 2 | 
             
              doc = Doc.new :issue_on=> Date.today, :process_at => Time.now
         | 
| 3 3 | 
             
            %>
         | 
| 4 4 | 
             
            <%#= fields_for doc do |f| %>
         | 
| 5 | 
            -
              <%#= f.label :rnum, " | 
| 5 | 
            +
              <%#= f.label :rnum, "Reference number" %>
         | 
| 6 6 | 
             
              <%#= f.text_field :rnum %>
         | 
| 7 | 
            -
              <%#= f.label :confidential, " | 
| 8 | 
            -
              <%#= f.select :confidential, [[' | 
| 9 | 
            -
              <%#= f.label :issue_on, " | 
| 7 | 
            +
              <%#= f.label :confidential, "Confidentiality" %>
         | 
| 8 | 
            +
              <%#= f.select :confidential, [['normal',0],['secret',1],['top secret',2]],{},"data-native-menu"=>"false" %>
         | 
| 9 | 
            +
              <%#= f.label :issue_on, "Dated" %>
         | 
| 10 10 | 
             
              <%#= f.date_field :issue_on, "blackDays"=>[0,6] %>
         | 
| 11 | 
            -
              <%#= f.label :summary, " | 
| 11 | 
            +
              <%#= f.label :summary, "Summary" %>
         | 
| 12 12 | 
             
              <%#= f.text_area :summary, :cols=>50, :rows=>6 %>
         | 
| 13 | 
            -
              <%#= f.label :dscan, " | 
| 13 | 
            +
              <%#= f.label :dscan, "Attached document" %>
         | 
| 14 14 | 
             
              <%#= f.file_field :dscan %>
         | 
| 15 15 | 
             
            <%# end %>
         | 
| 16 | 
            -
            <%#= label_tag :hotel, " | 
| 16 | 
            +
            <%#= label_tag :hotel, "Ungroup field" %>
         | 
| 17 17 | 
             
            <%#= text_field_tag :hotel %>
         | 
| 18 18 | 
             
            <!--div>
         | 
| 19 | 
            -
              <%#= label_tag :done1, " | 
| 20 | 
            -
              <%#= select_tag :done1, options_for_select([[' | 
| 19 | 
            +
              <%#= label_tag :done1, "Logic field" %>
         | 
| 20 | 
            +
              <%#= select_tag :done1, options_for_select([['Yes', 'y'], ['No', 'n']],'y'), 'data-role'=>"slider" %>
         | 
| 21 21 | 
             
            </div-->
         | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # -*- encoding : utf-8 -*-
         | 
| 1 2 | 
             
            class Mindapp::Doc
         | 
| 2 3 | 
             
              include Mongoid::Document
         | 
| 3 4 | 
             
              include Mongoid::Timestamps
         | 
| @@ -18,13 +19,13 @@ class Mindapp::Doc | |
| 18 19 |  | 
| 19 20 | 
             
              def self.search(q, page, per_page=PER_PAGE)
         | 
| 20 21 | 
             
                paginate :per_page=>per_page, :page => page, :conditions =>
         | 
| 21 | 
            -
                  ["content_type=? AND data_text LIKE ? AND (secured=? OR  | 
| 22 | 
            +
                  ["content_type=? AND data_text LIKE ? AND (secured=? OR ma_user_id=?)",
         | 
| 22 23 | 
             
                  "output", "%#{q}%", false, session[:user_id] ],
         | 
| 23 | 
            -
                  :order=>' | 
| 24 | 
            +
                  :order=>'ma_xmain_id DESC', :select=>'DISTINCT ma_xmain_id'
         | 
| 24 25 | 
             
              end
         | 
| 25 26 | 
             
              def self.search_secured(q, page, per_page=PER_PAGE)
         | 
| 26 27 | 
             
                paginate :per_page=>per_page, :page => page, :conditions =>
         | 
| 27 28 | 
             
                  ["content_type=? AND data_text LIKE ?", "output", "%#{q}%" ],
         | 
| 28 | 
            -
                  :order=>' | 
| 29 | 
            +
                  :order=>'ma_xmain_id DESC', :select=>'DISTINCT ma_xmain_id'
         | 
| 29 30 | 
             
              end
         | 
| 30 31 | 
             
            end
         | 
| @@ -2,13 +2,13 @@ | |
| 2 2 | 
             
            class Param
         | 
| 3 3 | 
             
              include Mongoid::Document
         | 
| 4 4 | 
             
              validates_uniqueness_of :code
         | 
| 5 | 
            -
              #  | 
| 5 | 
            +
              # mindapp begin
         | 
| 6 6 | 
             
              include Mongoid::Timestamps
         | 
| 7 7 | 
             
              field :code, :type => String
         | 
| 8 8 | 
             
              field :pid, :type => String
         | 
| 9 9 | 
             
              field :yearly, :type => Boolean
         | 
| 10 10 | 
             
              field :description, :type => String
         | 
| 11 | 
            -
              #  | 
| 11 | 
            +
              # mindapp end
         | 
| 12 12 |  | 
| 13 13 | 
             
              def self.get(code)
         | 
| 14 14 | 
             
                p= where(:code=> code).first
         | 
| @@ -10,7 +10,7 @@ | |
| 10 10 | 
             
                    = render "/mindapp/menu_mm"
         | 
| 11 11 | 
             
                    - if login?
         | 
| 12 12 | 
             
                      %li
         | 
| 13 | 
            -
                        %a{:href=>"/mindapp/pending", "data-rel"=>"dialog", "data-panel" => "main"} Pending  | 
| 13 | 
            +
                        %a{:href=>"/mindapp/pending", "data-rel"=>"dialog", "data-panel" => "main"} Pending Tasks
         | 
| 14 14 | 
             
                      %li
         | 
| 15 15 | 
             
                        %a{"data-panel" => "main", :href => logout_path, "data-ajax"=>"false"} Sign Out
         | 
| 16 16 | 
             
                    - else
         | 
| @@ -20,11 +20,10 @@ | |
| 20 20 | 
             
                      - name, url = s.name.split(":", 2)
         | 
| 21 21 | 
             
                      - url.strip!
         | 
| 22 22 | 
             
                    - else
         | 
| 23 | 
            -
                      - name= s.name
         | 
| 24 | 
            -
                      - url= "/mindapp/init/#{s.module_code}/#{s.code}"
         | 
| 23 | 
            +
                      - name= s.name; url= "/mindapp/init?s=#{s.module_code}:#{s.code}"
         | 
| 25 24 | 
             
                    - if s.confirm
         | 
| 26 25 | 
             
                      %li
         | 
| 27 | 
            -
                        %a{"data-panel"=>"main", :onclick=>"if (confirm(' | 
| 26 | 
            +
                        %a{"data-panel"=>"main", :onclick=>"if (confirm('Please Confirm')) {location.hash='#{url}'};"}= name
         | 
| 28 27 | 
             
                    - else
         | 
| 29 28 | 
             
                      %li
         | 
| 30 29 | 
             
                        %a{"data-panel"=>"main", :href=> url}= name
         | 
| @@ -14,7 +14,6 @@ | |
| 14 14 | 
             
                - @runseq= Mindapp::Runseq.find(xmain.current_runseq)
         | 
| 15 15 | 
             
                - next unless @runseq
         | 
| 16 16 | 
             
                - next unless %w(form output pdf).include?(@runseq.action)
         | 
| 17 | 
            -
                /- debugger
         | 
| 18 17 | 
             
                - next if @xmain.runseqs.first==@xmain.current_runseq && @xmain.user!=current_user
         | 
| 19 18 | 
             
                - next unless authorize?
         | 
| 20 19 | 
             
                %tr
         | 
| @@ -22,5 +21,5 @@ | |
| 22 21 | 
             
                  %td= link_to xmain.name, :controller=>"mindapp", :action=>"run", :id=>xmain.id
         | 
| 23 22 | 
             
                  %td= @runseq.name
         | 
| 24 23 | 
             
                  %td{:align=>'center'}= xmain.user.try :code
         | 
| 25 | 
            -
                  %td=  | 
| 24 | 
            +
                  %td= xmain.start.strftime("%c")
         | 
| 26 25 | 
             
                  %td(align='center')= link_to image_tag('delete.png', style:'border:none; float:none;'), "#", :onclick=>"if (confirm('กรุณายืนยัน')) {location.hash='/mindapp/cancel/#{xmain.id}';}"
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            - @title= "Error Logs"
         | 
| 2 | 
            +
            = paginate @xmains
         | 
| 3 | 
            +
            %table{:id=>"pending-table", :width=>"100%"}
         | 
| 4 | 
            +
              %tr{:style=>"color:white; background-color:#97BF60;"}
         | 
| 5 | 
            +
                %th id
         | 
| 6 | 
            +
                %th task
         | 
| 7 | 
            +
                %th step
         | 
| 8 | 
            +
                %th starter
         | 
| 9 | 
            +
                %th begin
         | 
| 10 | 
            +
                %th message
         | 
| 11 | 
            +
              - @xmains.each do |xmain|
         | 
| 12 | 
            +
                - @xmain= xmain
         | 
| 13 | 
            +
                - next unless xmain.current_runseq
         | 
| 14 | 
            +
                - @runseq= Mindapp::Runseq.find(xmain.current_runseq)
         | 
| 15 | 
            +
                - next unless @runseq
         | 
| 16 | 
            +
                %tr
         | 
| 17 | 
            +
                  %td= xmain.xid
         | 
| 18 | 
            +
                  %td= xmain.name
         | 
| 19 | 
            +
                  %td= @runseq.name
         | 
| 20 | 
            +
                  %td(align="center")= xmain.user.try :code
         | 
| 21 | 
            +
                  %td= xmain.start.strftime("%c")
         | 
| 22 | 
            +
                  %td(style="width:50%")= xmain.xvars["error"]
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            - @title= "Mindapp Logs"
         | 
| 2 | 
            +
            = paginate @xmains
         | 
| 3 | 
            +
            %table{:id=>"pending-table", :width=>"100%"}
         | 
| 4 | 
            +
              %tr{:style=>"color:white; background-color:#97BF60;"}
         | 
| 5 | 
            +
                %th id
         | 
| 6 | 
            +
                %th task
         | 
| 7 | 
            +
                %th step
         | 
| 8 | 
            +
                %th starter
         | 
| 9 | 
            +
                %th begin
         | 
| 10 | 
            +
                %th status
         | 
| 11 | 
            +
              - @xmains.each do |xmain|
         | 
| 12 | 
            +
                - @xmain= xmain
         | 
| 13 | 
            +
                - next unless xmain.current_runseq
         | 
| 14 | 
            +
                - @runseq= Mindapp::Runseq.find(xmain.current_runseq)
         | 
| 15 | 
            +
                - next unless @runseq
         | 
| 16 | 
            +
                %tr
         | 
| 17 | 
            +
                  %td= xmain.xid
         | 
| 18 | 
            +
                  %td= xmain.name
         | 
| 19 | 
            +
                  %td= @runseq.name
         | 
| 20 | 
            +
                  %td(align="center")= xmain.user.try :code
         | 
| 21 | 
            +
                  %td= xmain.start.strftime("%c")
         | 
| 22 | 
            +
                  %td(align="center")= status_icon(xmain.status)
         | 
| @@ -26,7 +26,7 @@ | |
| 26 26 | 
             
                  //Deterime where our character code is coming from within the event
         | 
| 27 27 | 
             
                  var charCode = evt.charCode || evt.keyCode;
         | 
| 28 28 | 
             
                  if (charCode  == 13) { //Enter key's keycode
         | 
| 29 | 
            -
                    alert(" | 
| 29 | 
            +
                    alert("Please click the button");
         | 
| 30 30 | 
             
                    return false;
         | 
| 31 31 | 
             
                  }
         | 
| 32 32 | 
             
                });
         | 
| @@ -14,7 +14,7 @@ | |
| 14 14 | 
             
                %tr
         | 
| 15 15 | 
             
                  %td= link_to xmain.id, :action=>"status", :id=>xmain.id
         | 
| 16 16 | 
             
                  %td= link_to xmain.name, :action=>"status", :id=>xmain.id
         | 
| 17 | 
            -
                  %td{:align=>'center'}= xmain. | 
| 17 | 
            +
                  %td{:align=>'center'}= xmain.ma_user.full_name
         | 
| 18 18 | 
             
                  %td= date_thai xmain.start, :date_only=>true
         | 
| 19 19 | 
             
                  %td= xmain.stop ? date_thai(xmain.stop, :date_only=>true) : ' '
         | 
| 20 20 | 
             
                  %td(align='center')= status_icon xmain
         | 
| @@ -10,7 +10,7 @@ | |
| 10 10 | 
             
                  - if @xmain.status=='X'
         | 
| 11 11 | 
             
                    %td{:align=>'center'}= image_tag 'cancel.png'
         | 
| 12 12 | 
             
                  - else
         | 
| 13 | 
            -
                    %td{:align=>'center'}= status_icon(r)
         | 
| 13 | 
            +
                    %td{:align=>'center'}= status_icon(r.status)
         | 
| 14 14 | 
             
                  %td= r.name
         | 
| 15 15 | 
             
                  %td{:align=>'center'}
         | 
| 16 16 | 
             
                    - if r.role.blank? && @xvars[:action]
         | 
| @@ -57,5 +57,5 @@ | |
| 57 57 | 
             
                      = image_tag 'page_attach.png'
         | 
| 58 58 | 
             
                    = link_to align_text(doc.name), "/engine/document/#{doc.id}", :target=>'_blank'
         | 
| 59 59 | 
             
                  %td= doc.filename
         | 
| 60 | 
            -
                  %td= doc. | 
| 60 | 
            +
                  %td= doc.ma_user.full_name
         | 
| 61 61 | 
             
                  %td= date_thai doc.created_at
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            .field(data-role="fieldcontain")
         | 
| 2 | 
            +
              %label.ui-input-text Name
         | 
| 3 | 
            +
              = b current_user.code
         | 
| 4 | 
            +
            .field(data-role="fieldcontain")
         | 
| 5 | 
            +
              %label.ui-input-text Email
         | 
| 6 | 
            +
              = b current_user.email
         | 
| 7 | 
            +
            .field(data-role="fieldcontain")
         | 
| 8 | 
            +
              %label.ui-input-text Role
         | 
| 9 | 
            +
              = b current_user.role
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - if @xmains
         | 
| 12 | 
            +
              %h2 Pending Tasks
         | 
| 13 | 
            +
              = render :partial=>"mindapp/pending_page", :locals=>{:xmains=>@xmains}
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Specs in this file have access to a helper object that includes
         | 
| 4 | 
            +
            # the AdminsHelper. For example:
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # describe AdminsHelper do
         | 
| 7 | 
            +
            #   describe "string concat" do
         | 
| 8 | 
            +
            #     it "concats two strings with spaces" do
         | 
| 9 | 
            +
            #       helper.concat_strings("this","that").should == "this that"
         | 
| 10 | 
            +
            #     end
         | 
| 11 | 
            +
            #   end
         | 
| 12 | 
            +
            # end
         | 
| 13 | 
            +
            describe AdminsHelper do
         | 
| 14 | 
            +
              pending "add some examples to (or delete) #{__FILE__}"
         | 
| 15 | 
            +
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Specs in this file have access to a helper object that includes
         | 
| 4 | 
            +
            # the DevsHelper. For example:
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # describe DevsHelper do
         | 
| 7 | 
            +
            #   describe "string concat" do
         | 
| 8 | 
            +
            #     it "concats two strings with spaces" do
         | 
| 9 | 
            +
            #       helper.concat_strings("this","that").should == "this that"
         | 
| 10 | 
            +
            #     end
         | 
| 11 | 
            +
            #   end
         | 
| 12 | 
            +
            # end
         | 
| 13 | 
            +
            describe DevsHelper do
         | 
| 14 | 
            +
              pending "add some examples to (or delete) #{__FILE__}"
         | 
| 15 | 
            +
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Specs in this file have access to a helper object that includes
         | 
| 4 | 
            +
            # the UsersHelper. For example:
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # describe UsersHelper do
         | 
| 7 | 
            +
            #   describe "string concat" do
         | 
| 8 | 
            +
            #     it "concats two strings with spaces" do
         | 
| 9 | 
            +
            #       helper.concat_strings("this","that").should == "this that"
         | 
| 10 | 
            +
            #     end
         | 
| 11 | 
            +
            #   end
         | 
| 12 | 
            +
            # end
         | 
| 13 | 
            +
            describe UsersHelper do
         | 
| 14 | 
            +
              pending "add some examples to (or delete) #{__FILE__}"
         | 
| 15 | 
            +
            end
         | 
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            # This file is copied to spec/ when you run 'rails generate rspec:install'
         | 
| 2 | 
            +
            ENV["RAILS_ENV"] ||= 'test'
         | 
| 3 | 
            +
            require File.expand_path("../../config/environment", __FILE__)
         | 
| 4 | 
            +
            require 'rspec/rails'
         | 
| 5 | 
            +
            require 'rspec/autorun'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # Requires supporting ruby files with custom matchers and macros, etc,
         | 
| 8 | 
            +
            # in spec/support/ and its subdirectories.
         | 
| 9 | 
            +
            Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            RSpec.configure do |config|
         | 
| 12 | 
            +
              # ## Mock Framework
         | 
| 13 | 
            +
              #
         | 
| 14 | 
            +
              # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
         | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              # config.mock_with :mocha
         | 
| 17 | 
            +
              # config.mock_with :flexmock
         | 
| 18 | 
            +
              # config.mock_with :rr
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
         | 
| 21 | 
            +
              config.fixture_path = "#{::Rails.root}/spec/fixtures"
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              # If you're not using ActiveRecord, or you'd prefer not to run each of your
         | 
| 24 | 
            +
              # examples within a transaction, remove the following line or assign false
         | 
| 25 | 
            +
              # instead of true.
         | 
| 26 | 
            +
              config.use_transactional_fixtures = true
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              # If true, the base class of anonymous controllers will be inferred
         | 
| 29 | 
            +
              # automatically. This will be the default behavior in future versions of
         | 
| 30 | 
            +
              # rspec-rails.
         | 
| 31 | 
            +
              config.infer_base_class_for_anonymous_controllers = false
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              # Run specs in random order to surface order dependencies. If you find an
         | 
| 34 | 
            +
              # order dependency and want to debug it, you can fix the order by providing
         | 
| 35 | 
            +
              # the seed, which is printed after each run.
         | 
| 36 | 
            +
              #     --seed 1234
         | 
| 37 | 
            +
              config.order = "random"
         | 
| 38 | 
            +
            end
         | 
    
        data/lib/mindapp/helpers.rb
    CHANGED
    
    | @@ -2,12 +2,15 @@ module Mindapp | |
| 2 2 | 
             
              module Helpers
         | 
| 3 3 |  | 
| 4 4 | 
             
                # methods from application_controller
         | 
| 5 | 
            +
                def b(s)
         | 
| 6 | 
            +
                  "<b>#{s}</b>".html_safe
         | 
| 7 | 
            +
                end
         | 
| 5 8 | 
             
                def code_text(s) # old def code(s)
         | 
| 6 9 | 
             
                  "<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'>#{s}</code></pre>".html_safe
         | 
| 7 10 | 
             
                end
         | 
| 8 11 | 
             
                def refresh_to(url='/', option={})
         | 
| 9 12 | 
             
                  if option[:alert]
         | 
| 10 | 
            -
                     | 
| 13 | 
            +
                    ma_log option[:alert]
         | 
| 11 14 | 
             
                  end
         | 
| 12 15 | 
             
                  render :text => "<script>window.location.replace('#{url}')</script>"
         | 
| 13 16 | 
             
                end
         | 
| @@ -27,7 +30,7 @@ module Mindapp | |
| 27 30 | 
             
                  c, h= url.split(':', 2)
         | 
| 28 31 | 
             
                  opt= h ? h.strip : false
         | 
| 29 32 | 
             
                end
         | 
| 30 | 
            -
                def  | 
| 33 | 
            +
                def ma_comment?(s)
         | 
| 31 34 | 
             
                  s[0]==35
         | 
| 32 35 | 
             
                end
         | 
| 33 36 | 
             
                def get_ip
         | 
| @@ -85,7 +88,7 @@ module Mindapp | |
| 85 88 | 
             
                    return current_user.has_role(role)
         | 
| 86 89 | 
             
                  end
         | 
| 87 90 | 
             
                end
         | 
| 88 | 
            -
                def  | 
| 91 | 
            +
                def ma_log(message)
         | 
| 89 92 | 
             
                  Mindapp::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
         | 
| 90 93 | 
             
                    :user_id => $user.id, :unread=> true
         | 
| 91 94 | 
             
                end
         | 
| @@ -99,8 +102,8 @@ module Mindapp | |
| 99 102 | 
             
                def align_text(s, pixel=3)
         | 
| 100 103 | 
             
                  "<span style='position:relative; top:-#{pixel}px;'>#{s}</span>".html_safe
         | 
| 101 104 | 
             
                end
         | 
| 102 | 
            -
                def status_icon( | 
| 103 | 
            -
                  case  | 
| 105 | 
            +
                def status_icon(status)
         | 
| 106 | 
            +
                  case status
         | 
| 104 107 | 
             
                  when 'R'
         | 
| 105 108 | 
             
                    image_tag 'user.png'
         | 
| 106 109 | 
             
                  when 'F'
         | 
| @@ -155,7 +158,7 @@ module Mindapp | |
| 155 158 | 
             
                def ui_action?(s)
         | 
| 156 159 | 
             
                  %w(form output mail pdf).include? s
         | 
| 157 160 | 
             
                end
         | 
| 158 | 
            -
                # def  | 
| 161 | 
            +
                # def handle_ma_notice
         | 
| 159 162 | 
             
                #   if Mindapp::Notice.recent.count>0
         | 
| 160 163 | 
             
                #     notice= Mindapp::Notice.recent.last
         | 
| 161 164 | 
             
                #     notice.update_attribute :unread, false
         | 
| @@ -208,9 +211,9 @@ module Mindapp | |
| 208 211 | 
             
                        ma_service= Mindapp::Service.find_or_create_by :module_code=> ma_module.code, :code=> scode, :name=> sname
         | 
| 209 212 | 
             
                        ma_service.update_attributes :xml=>s.to_s, :name=>sname,
         | 
| 210 213 | 
             
                          :list=>listed(s), :secured=>secured?(s),
         | 
| 211 | 
            -
                          :module_id=> | 
| 214 | 
            +
                          :module_id=>ma_module.id, :seq => seq,
         | 
| 212 215 | 
             
                          :confirm=> get_option_xml("confirm", xml),
         | 
| 213 | 
            -
                          :role => role, :rule => rule, :uid=>  | 
| 216 | 
            +
                          :role => role, :rule => rule, :uid=> ma_service.id.to_s
         | 
| 214 217 | 
             
                        seq += 1
         | 
| 215 218 | 
             
                        protected_services << ma_service.uid
         | 
| 216 219 | 
             
                      else
         | 
| @@ -233,9 +236,9 @@ module Mindapp | |
| 233 236 | 
             
                  Mindapp::Service.not_in(:uid=>protected_services).delete_all
         | 
| 234 237 | 
             
                end
         | 
| 235 238 | 
             
                def get_app
         | 
| 236 | 
            -
                  dir= "#{Rails.root}/app/mindapp"
         | 
| 237 | 
            -
                  f= "#{ | 
| 238 | 
            -
                  t= REXML::Document.new(File.read( | 
| 239 | 
            +
                  # dir= "#{Rails.root}/app/mindapp"
         | 
| 240 | 
            +
                  f= MM || "#{Rails.root}/app/mindapp/index.mm"
         | 
| 241 | 
            +
                  t= REXML::Document.new(File.read(MM).gsub("\n","")).root
         | 
| 239 242 | 
             
                  recheck= true ; first_pass= true
         | 
| 240 243 | 
             
                  while recheck
         | 
| 241 244 | 
             
                    recheck= false
         | 
| @@ -274,7 +277,7 @@ module Mindapp | |
| 274 277 | 
             
                  session[:user_id] != nil
         | 
| 275 278 | 
             
                end
         | 
| 276 279 | 
             
                def own_xmain?
         | 
| 277 | 
            -
                  if $ | 
| 280 | 
            +
                  if $xmain
         | 
| 278 281 | 
             
                    return $user.id==$xvars['user_id']
         | 
| 279 282 | 
             
                  else
         | 
| 280 283 | 
             
                    # if eval on first step would return true so user can start service
         | 
    
        data/lib/mindapp/version.rb
    CHANGED
    
    
    
        data/mindapp.gemspec
    CHANGED
    
    | @@ -8,9 +8,9 @@ Gem::Specification.new do |gem| | |
| 8 8 | 
             
              gem.version       = Mindapp::VERSION
         | 
| 9 9 | 
             
              gem.authors       = ["songrit"]
         | 
| 10 10 | 
             
              gem.email         = ["songrit@gmail.com"]
         | 
| 11 | 
            -
              gem.description   = %q{generate  | 
| 12 | 
            -
              gem.summary       = %q{generate  | 
| 13 | 
            -
              gem.homepage      = ""
         | 
| 11 | 
            +
              gem.description   = %q{generate Ruby on Rails app from mind map}
         | 
| 12 | 
            +
              gem.summary       = %q{generate Ruby on Rails app from mind map}
         | 
| 13 | 
            +
              gem.homepage      = "https://github.com/songrit/mindapp"
         | 
| 14 14 |  | 
| 15 15 | 
             
              gem.files         = `git ls-files`.split($/)
         | 
| 16 16 | 
             
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mindapp
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,9 +9,9 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013-01- | 
| 12 | 
            +
            date: 2013-01-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies: []
         | 
| 14 | 
            -
            description: generate  | 
| 14 | 
            +
            description: generate Ruby on Rails app from mind map
         | 
| 15 15 | 
             
            email:
         | 
| 16 16 | 
             
            - songrit@gmail.com
         | 
| 17 17 | 
             
            executables: []
         | 
| @@ -65,7 +65,9 @@ files: | |
| 65 65 | 
             
            - lib/generators/mindapp/templates/app/assets/images/tick.png
         | 
| 66 66 | 
             
            - lib/generators/mindapp/templates/app/assets/images/user.png
         | 
| 67 67 | 
             
            - lib/generators/mindapp/templates/app/assets/images/view_code.png
         | 
| 68 | 
            +
            - lib/generators/mindapp/templates/app/assets/javascripts/admins.js.coffee
         | 
| 68 69 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/application.js
         | 
| 70 | 
            +
            - lib/generators/mindapp/templates/app/assets/javascripts/devs.js.coffee
         | 
| 69 71 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/disable_enter_key.js
         | 
| 70 72 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/iscroll-wrapper.js
         | 
| 71 73 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/iscroll.js
         | 
| @@ -74,7 +76,10 @@ files: | |
| 74 76 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/jquery.mobile.js
         | 
| 75 77 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/jquery.mobile.splitview.js
         | 
| 76 78 | 
             
            - lib/generators/mindapp/templates/app/assets/javascripts/mindapp.js
         | 
| 79 | 
            +
            - lib/generators/mindapp/templates/app/assets/javascripts/users.js.coffee
         | 
| 80 | 
            +
            - lib/generators/mindapp/templates/app/assets/stylesheets/admins.css.scss
         | 
| 77 81 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/application.css.scss
         | 
| 82 | 
            +
            - lib/generators/mindapp/templates/app/assets/stylesheets/devs.css.scss
         | 
| 78 83 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/fonts/sarabun.eot
         | 
| 79 84 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/fonts/sarabun.ttf
         | 
| 80 85 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/fonts/sarabun.woff
         | 
| @@ -156,10 +161,16 @@ files: | |
| 156 161 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/jquery.mobile.splitview.css
         | 
| 157 162 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/mindapp.css
         | 
| 158 163 | 
             
            - lib/generators/mindapp/templates/app/assets/stylesheets/sarabun.css
         | 
| 164 | 
            +
            - lib/generators/mindapp/templates/app/assets/stylesheets/users.css.scss
         | 
| 165 | 
            +
            - lib/generators/mindapp/templates/app/controllers/admins_controller.rb
         | 
| 166 | 
            +
            - lib/generators/mindapp/templates/app/controllers/devs_controller.rb
         | 
| 159 167 | 
             
            - lib/generators/mindapp/templates/app/controllers/identities_controller.rb
         | 
| 160 168 | 
             
            - lib/generators/mindapp/templates/app/controllers/mindapp_controller.rb
         | 
| 161 169 | 
             
            - lib/generators/mindapp/templates/app/controllers/sessions_controller.rb
         | 
| 162 | 
            -
            - lib/generators/mindapp/templates/app/ | 
| 170 | 
            +
            - lib/generators/mindapp/templates/app/controllers/users_controller.rb
         | 
| 171 | 
            +
            - lib/generators/mindapp/templates/app/helpers/admins_helper.rb
         | 
| 172 | 
            +
            - lib/generators/mindapp/templates/app/helpers/devs_helper.rb
         | 
| 173 | 
            +
            - lib/generators/mindapp/templates/app/helpers/users_helper.rb
         | 
| 163 174 | 
             
            - lib/generators/mindapp/templates/app/mailers/mindapp_mailer.rb
         | 
| 164 175 | 
             
            - lib/generators/mindapp/templates/app/mindapp/index.mm
         | 
| 165 176 | 
             
            - lib/generators/mindapp/templates/app/mindapp/template/view.html.erb
         | 
| @@ -174,6 +185,8 @@ files: | |
| 174 185 | 
             
            - lib/generators/mindapp/templates/app/models/mindapp/xmain.rb
         | 
| 175 186 | 
             
            - lib/generators/mindapp/templates/app/models/param.rb
         | 
| 176 187 | 
             
            - lib/generators/mindapp/templates/app/models/user.rb
         | 
| 188 | 
            +
            - lib/generators/mindapp/templates/app/views/admins/edit_role/edit_role.html.erb
         | 
| 189 | 
            +
            - lib/generators/mindapp/templates/app/views/admins/edit_role/select_user.html.erb
         | 
| 177 190 | 
             
            - lib/generators/mindapp/templates/app/views/identities/new.html.erb
         | 
| 178 191 | 
             
            - lib/generators/mindapp/templates/app/views/layouts/_full.haml
         | 
| 179 192 | 
             
            - lib/generators/mindapp/templates/app/views/layouts/_head.html.erb
         | 
| @@ -195,24 +208,36 @@ files: | |
| 195 208 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/_service.md
         | 
| 196 209 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/_static.haml
         | 
| 197 210 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/doc.md
         | 
| 211 | 
            +
            - lib/generators/mindapp/templates/app/views/mindapp/error_logs.haml
         | 
| 198 212 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/feed.rss.builder
         | 
| 199 213 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/help.haml
         | 
| 200 214 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/index.html.haml
         | 
| 215 | 
            +
            - lib/generators/mindapp/templates/app/views/mindapp/logs.haml
         | 
| 201 216 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/pending.haml
         | 
| 202 217 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/run_form.haml
         | 
| 203 218 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/search.haml
         | 
| 204 219 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp/status.haml
         | 
| 205 220 | 
             
            - lib/generators/mindapp/templates/app/views/mindapp_mailer/gmail.html.erb
         | 
| 206 221 | 
             
            - lib/generators/mindapp/templates/app/views/sessions/new.html.erb
         | 
| 222 | 
            +
            - lib/generators/mindapp/templates/app/views/users/index.haml
         | 
| 223 | 
            +
            - lib/generators/mindapp/templates/app/views/users/pwd/enter.html.erb
         | 
| 224 | 
            +
            - lib/generators/mindapp/templates/app/views/users/user/enter_user.html.erb
         | 
| 207 225 | 
             
            - lib/generators/mindapp/templates/mindapp.yml
         | 
| 208 226 | 
             
            - lib/generators/mindapp/templates/seeds.rb
         | 
| 227 | 
            +
            - lib/generators/mindapp/templates/spec/controllers/admins_controller_spec.rb
         | 
| 228 | 
            +
            - lib/generators/mindapp/templates/spec/controllers/devs_controller_spec.rb
         | 
| 229 | 
            +
            - lib/generators/mindapp/templates/spec/controllers/users_controller_spec.rb
         | 
| 230 | 
            +
            - lib/generators/mindapp/templates/spec/helpers/admins_helper_spec.rb
         | 
| 231 | 
            +
            - lib/generators/mindapp/templates/spec/helpers/devs_helper_spec.rb
         | 
| 232 | 
            +
            - lib/generators/mindapp/templates/spec/helpers/users_helper_spec.rb
         | 
| 233 | 
            +
            - lib/generators/mindapp/templates/spec/spec_helper.rb
         | 
| 209 234 | 
             
            - lib/mindapp.rb
         | 
| 210 235 | 
             
            - lib/mindapp/helpers.rb
         | 
| 211 236 | 
             
            - lib/mindapp/railtie.rb
         | 
| 212 237 | 
             
            - lib/mindapp/version.rb
         | 
| 213 238 | 
             
            - lib/tasks/mindapp.rake
         | 
| 214 239 | 
             
            - mindapp.gemspec
         | 
| 215 | 
            -
            homepage:  | 
| 240 | 
            +
            homepage: https://github.com/songrit/mindapp
         | 
| 216 241 | 
             
            licenses: []
         | 
| 217 242 | 
             
            post_install_message: 
         | 
| 218 243 | 
             
            rdoc_options: []
         | 
| @@ -235,5 +260,5 @@ rubyforge_project: | |
| 235 260 | 
             
            rubygems_version: 1.8.24
         | 
| 236 261 | 
             
            signing_key: 
         | 
| 237 262 | 
             
            specification_version: 3
         | 
| 238 | 
            -
            summary: generate  | 
| 263 | 
            +
            summary: generate Ruby on Rails app from mind map
         | 
| 239 264 | 
             
            test_files: []
         | 
| 
            File without changes
         |