mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-30 22:43:29 +00:00 
			
		
		
		
	ditch b-modal
This commit is contained in:
		| @@ -35,7 +35,7 @@ | |||||||
|                     <span class="icon">{% inline "assorted.svg" %}</span> |                     <span class="icon">{% inline "assorted.svg" %}</span> | ||||||
|                 </button> |                 </button> | ||||||
|                 <div class="flex-grow-1"></div> |                 <div class="flex-grow-1"></div> | ||||||
|                 <dropdown class="settings-dropdown" toggle-class="btn btn-link toolbar-item px-2" ref="menuDropdown" drop="right" title="Settings"> |                 <dropdown class="settings-dropdown" toggle-class="btn btn-link toolbar-item px-2" ref="menuDropdown" drop="right" title="settings = ''"> | ||||||
|                     <template v-slot:button> |                     <template v-slot:button> | ||||||
|                         <span class="icon">{% inline "more-horizontal.svg" %}</span> |                         <span class="icon">{% inline "more-horizontal.svg" %}</span> | ||||||
|                     </template> |                     </template> | ||||||
| @@ -260,8 +260,8 @@ | |||||||
|                 <div v-html="itemSelectedContent"></div> |                 <div v-html="itemSelectedContent"></div> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|         <b-modal id="settings-modal" hide-header hide-footer lazy> |         <modal :open="!!settings" @hide="settings = ''"> | ||||||
|             <button class="btn btn-link outline-none float-right p-2 mr-n2 mt-n2" style="line-height: 1" @click="$bvModal.hide('settings-modal')"> |             <button class="btn btn-link outline-none float-right p-2 mr-n2 mt-n2" style="line-height: 1" @click="settings = ''"> | ||||||
|                 <span class="icon">{% inline "x.svg" %}</span> |                 <span class="icon">{% inline "x.svg" %}</span> | ||||||
|             </button> |             </button> | ||||||
|             <div v-if="settings=='create'"> |             <div v-if="settings=='create'"> | ||||||
| @@ -423,7 +423,7 @@ | |||||||
|                     </tr> |                     </tr> | ||||||
|                 </table> |                 </table> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </modal> | ||||||
|     </div> |     </div> | ||||||
|     <!-- polyfill --> |     <!-- polyfill --> | ||||||
|     <script src="./static/javascripts/fetch.umd.js"></script> |     <script src="./static/javascripts/fetch.umd.js"></script> | ||||||
|   | |||||||
| @@ -136,6 +136,43 @@ Vue.component('dropdown', { | |||||||
|   }, |   }, | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | Vue.component('modal', { | ||||||
|  |   props: ['open'], | ||||||
|  |   template: ` | ||||||
|  |     <div class="modal custom-modal" tabindex="-1" v-if="$props.open"> | ||||||
|  |       <div class="modal-dialog"> | ||||||
|  |         <div class="modal-content" ref="content"> | ||||||
|  |           <div class="modal-body"> | ||||||
|  |             <slot v-if="$props.open"></slot> | ||||||
|  |           </div> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   `, | ||||||
|  |   data: function() { | ||||||
|  |     return {opening: false} | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     'open': function(newVal) { | ||||||
|  |       if (newVal) { | ||||||
|  |         this.opening = true | ||||||
|  |         document.addEventListener('click', this.handleClick) | ||||||
|  |       } else { | ||||||
|  |         document.removeEventListener('click', this.handleClick) | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     handleClick: function(e) { | ||||||
|  |       if (this.opening) { | ||||||
|  |         this.opening = false | ||||||
|  |         return | ||||||
|  |       } | ||||||
|  |       if (e.target.closest('.modal-content') == null) this.$emit('hide') | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }) | ||||||
|  |  | ||||||
| function dateRepr(d) { | function dateRepr(d) { | ||||||
|   var sec = (new Date().getTime() - d.getTime()) / 1000 |   var sec = (new Date().getTime() - d.getTime()) / 1000 | ||||||
|   var neg = sec < 0 |   var neg = sec < 0 | ||||||
| @@ -181,14 +218,6 @@ var vm = new Vue({ | |||||||
|     this.refreshFeeds() |     this.refreshFeeds() | ||||||
|     this.refreshStats() |     this.refreshStats() | ||||||
|   }, |   }, | ||||||
|   mounted: function() { |  | ||||||
|     this.$root.$on('bv::modal::hidden', function(bvEvent, modalId) { |  | ||||||
|       if (vm.settings == 'create') { |  | ||||||
|         vm.feedNewChoice = [] |  | ||||||
|         vm.feedNewChoiceSelected = '' |  | ||||||
|       } |  | ||||||
|     }) |  | ||||||
|   }, |  | ||||||
|   data: function() { |   data: function() { | ||||||
|     return { |     return { | ||||||
|       'filterSelected': undefined, |       'filterSelected': undefined, | ||||||
| @@ -214,7 +243,7 @@ var vm = new Vue({ | |||||||
|       'filteredFolderStats': {}, |       'filteredFolderStats': {}, | ||||||
|       'filteredTotalStats': null, |       'filteredTotalStats': null, | ||||||
|  |  | ||||||
|       'settings': 'create', |       'settings': '', | ||||||
|       'loading': { |       'loading': { | ||||||
|         'feeds': 0, |         'feeds': 0, | ||||||
|         'newfeed': false, |         'newfeed': false, | ||||||
| @@ -525,7 +554,7 @@ var vm = new Vue({ | |||||||
|         if (result.status === 'success') { |         if (result.status === 'success') { | ||||||
|           vm.refreshFeeds() |           vm.refreshFeeds() | ||||||
|           vm.refreshStats() |           vm.refreshStats() | ||||||
|           vm.$bvModal.hide('settings-modal') |           vm.settings = '' | ||||||
|         } else if (result.status === 'multiple') { |         } else if (result.status === 'multiple') { | ||||||
|           vm.feedNewChoice = result.choice |           vm.feedNewChoice = result.choice | ||||||
|           vm.feedNewChoiceSelected = result.choice[0].url |           vm.feedNewChoiceSelected = result.choice[0].url | ||||||
| @@ -597,8 +626,11 @@ var vm = new Vue({ | |||||||
|     }, |     }, | ||||||
|     showSettings: function(settings) { |     showSettings: function(settings) { | ||||||
|       this.settings = settings |       this.settings = settings | ||||||
|       this.$bvModal.show('settings-modal') |  | ||||||
|  |  | ||||||
|  |       if (settings === 'create') { | ||||||
|  |         vm.feedNewChoice = [] | ||||||
|  |         vm.feedNewChoiceSelected = '' | ||||||
|  |       } | ||||||
|       if (settings === 'manage') { |       if (settings === 'manage') { | ||||||
|         api.feeds.list_errors().then(function(errors) { |         api.feeds.list_errors().then(function(errors) { | ||||||
|           vm.feed_errors = errors |           vm.feed_errors = errors | ||||||
|   | |||||||
| @@ -84,10 +84,6 @@ select.form-control:not([multiple]):not([size]) { | |||||||
|   outline: none; |   outline: none; | ||||||
| } | } | ||||||
|  |  | ||||||
| .modal-backdrop { |  | ||||||
|   background-color: rgba(0, 0, 0, 0.7); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .modal.fade .modal-dialog { | .modal.fade .modal-dialog { | ||||||
|   transition: none !important; |   transition: none !important; | ||||||
|   transform: none !important; |   transform: none !important; | ||||||
| @@ -384,6 +380,12 @@ select.form-control:not([multiple]):not([size]) { | |||||||
|   left: -999px; |   left: -999px; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .custom-modal { | ||||||
|  |   background-color: rgba(0, 0, 0, 0.9); | ||||||
|  |   overflow-y: auto; | ||||||
|  |   display: block !important; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* content */ | /* content */ | ||||||
|  |  | ||||||
| .content { | .content { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user