app/assets/javascripts/chr/core/module.coffee in chr-0.2.4 vs app/assets/javascripts/chr/core/module.coffee in chr-0.2.5

- old
+ new

@@ -14,20 +14,20 @@ # showNestedListsAside - show module root list on the left and all nested # lists on the right side for desktop # # Public methods: # addNestedList (listName, config, parentList) -# showNestedList (listName, animate=false) +# showNestedList (listName) # hideNestedLists (exceptList) # visibleNestedListShownWithParent () -# showRootList() -# hideActiveList (animate=false) -# showView (object, config, title, animate=false) -# showViewByObjectId (objectId, config, title, animate=false) +# showRootList () +# hideActiveList () +# showView (object, config, title) +# showViewByObjectId (objectId, config, title) # destroyView () # show () -# hide (animate=false) +# hide () # # ----------------------------------------------------------------------------- class @Module constructor: (@chr, @name, @config) -> @nestedLists = {} @@ -75,26 +75,25 @@ addNestedList: (listName, config, parentList) -> @nestedLists[listName] = new List(this, listName, config, parentList) - # shows one of nested lists, with or without animation - showNestedList: (listName, animate=false) -> + # shows one of nested lists + showNestedList: (listName) -> listToShow = @nestedLists[listName] if listToShow.showWithParent # list works as view, never becomes active listToShow.updateItems() - listToShow.show animate, => @hideNestedLists(exceptList=listName) + listToShow.show => @hideNestedLists(exceptList=listName) else @activeList = listToShow @_update_active_list_items() - @activeList.show(animate) + @activeList.show() - # hide view - if animate and @view then @view.$el.fadeOut $.fx.speeds._default, => @destroyView() + @destroyView() hideNestedLists: (exceptList) -> @activeList = @rootList list.hide() for key, list of @nestedLists when key isnt exceptList @@ -103,32 +102,32 @@ visibleNestedListShownWithParent: -> for key, list of @nestedLists if list.isVisible() && list.showWithParent then return list - showRootList: () -> + showRootList: -> @destroyView() while @activeList != @rootList - @hideActiveList(false) + @hideActiveList() - hideActiveList: (animate=false)-> - if animate then @activeList.$el.fadeOut() else @activeList.$el.hide() + hideActiveList: -> + @activeList.$el.hide() @activeList = @activeList.parentList - showView: (object, config, title, animate=false) -> + showView: (object, config, title) -> newView = new View(this, config, @_view_path(), object, title) @chr.$el.append(newView.$el) - newView.show animate, => + newView.show => @destroyView() @view = newView - showViewByObjectId: (objectId, config, title, animate=false) -> - onSuccess = (object) => @showView(object, config, title, animate) + showViewByObjectId: (objectId, config, title) -> + onSuccess = (object) => @showView(object, config, title) onError = -> chr.showError("can\'t show view for requested object") if objectId == '' config.objectStore.loadObject({ onSuccess: onSuccess, onError: onError }) else @@ -140,22 +139,16 @@ show: -> @_update_active_list_items() @$el.show() - @activeList.show(false) + @activeList.show() - hide: (animate=false) -> + hide: -> @hideNestedLists() - - if animate - # TODO: move animation to the view class - if @view then @view.$el.fadeOut $.fx.speeds._default, => @destroyView() - @$el.fadeOut() - else - @destroyView() - @$el.hide() + @destroyView() + @$el.hide()