Creates UserCapabilities plugin (will be usefull once we start working with Ref. #51. Small css adjustments.

This commit is contained in:
mateuswetah 2018-06-02 19:22:29 -03:00
parent 6132f33f8f
commit b616e1337b
8 changed files with 25 additions and 58 deletions

View File

@ -102,6 +102,9 @@
max-width: $side-menu-width; max-width: $side-menu-width;
z-index: 99; z-index: 99;
.menu {
padding-top: 10px;
}
.separator { .separator {
height: 2px; height: 2px;
background-color: $separator-color; background-color: $separator-color;

View File

@ -262,7 +262,6 @@ export default {
} }
.level-left { .level-left {
margin-left: 5px;
.level-item { .level-item {
display: inline-block; display: inline-block;
} }
@ -342,9 +341,6 @@ export default {
.level-left { .level-left {
margin-left: 0px !important; margin-left: 0px !important;
.level-item {
margin-left: 30px;
}
} }
top: 206px; top: 206px;
margin-bottom: 0px !important; margin-bottom: 0px !important;

View File

@ -41,7 +41,7 @@ import draggable from 'vuedraggable'
import store from '../../js/store/store' import store from '../../js/store/store'
import router from './router' import router from './router'
import eventBusSearch from '../../js/event-bus-search'; import eventBusSearch from '../../js/event-bus-search';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin } from './utilities'; import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin } from './utilities';
import VueMask from 'v-mask'; import VueMask from 'v-mask';
// Configure and Register Plugins // Configure and Register Plugins
@ -50,6 +50,7 @@ Vue.use(VTooltip)
Vue.use(I18NPlugin); Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin); Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin); Vue.use(RouterHelperPlugin);
Vue.use(UserCapabilitiesPlugin);
Vue.use(ConsolePlugin, {visual: false}); Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueMask); Vue.use(VueMask);

View File

@ -255,7 +255,19 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getEventEditPath(id) { getEventEditPath(id) {
return '/events/' + id + '/edit'; return '/events/' + id + '/edit';
} }
}
} }
// USER CAPABILITIES PLUGIN - Allows easy checking of user capabilities.
export const UserCapabilitiesPlugin = {};
UserCapabilitiesPlugin.install = function (Vue, options = {}) {
Vue.prototype.$userCaps = {
hasCapability(key) {
for (let i = 0; i < tainacan_plugin.user_caps.length; i++)
if (tainacan_plugin.user_caps[i] == key)
return true;
return false;
}
}
} }

View File

@ -4,7 +4,7 @@
<tainacan-title /> <tainacan-title />
<div <div
class="sub-header" class="sub-header"
v-if="checkIfUserCanEdit()"> v-if="$userCaps.hasCapability('edit_tainacan-taxonomies')">
<div class="header-item"> <div class="header-item">
<router-link <router-link
id="button-create-category" id="button-create-category"
@ -135,13 +135,6 @@
this.status = status; this.status = status;
this.loadCategories(); this.loadCategories();
}, },
checkIfUserCanEdit() {
for (let capability of tainacan_plugin.user_caps) {
if (capability == 'edit_tainacan-taxonomies')
return true;
}
return false;
},
onChangeCategoriesPerPage(value) { onChangeCategoriesPerPage(value) {
let prevValue = this.categoriesPerPage; let prevValue = this.categoriesPerPage;
this.categoriesPerPage = value; this.categoriesPerPage = value;
@ -205,7 +198,7 @@
padding-top: $page-small-top-padding; padding-top: $page-small-top-padding;
padding-left: $page-side-padding; padding-left: $page-side-padding;
padding-right: $page-side-padding; padding-right: $page-side-padding;
border-bottom: 0.5px solid #ddd; border-bottom: 1px solid #ddd;
.header-item { .header-item {
display: inline-block; display: inline-block;

View File

@ -3,7 +3,7 @@
<tainacan-title /> <tainacan-title />
<div <div
class="sub-header" class="sub-header"
v-if="checkIfUserCanEdit()"> v-if="$userCaps.hasCapability('edit_tainacan-collections')">
<div class="header-item"> <div class="header-item">
<b-dropdown id="collection-creation-options-dropdown"> <b-dropdown id="collection-creation-options-dropdown">
<button <button
@ -149,13 +149,6 @@ export default {
this.status = status; this.status = status;
this.loadCollections(); this.loadCollections();
}, },
checkIfUserCanEdit() {
for (let capability of tainacan_plugin.user_caps) {
if (capability == 'edit_tainacan-collections')
return true;
}
return false;
},
onChangeCollectionsPerPage(value) { onChangeCollectionsPerPage(value) {
let prevValue = this.collectionsPerPage; let prevValue = this.collectionsPerPage;
this.collectionsPerPage = value; this.collectionsPerPage = value;
@ -216,7 +209,7 @@ export default {
padding-top: $page-small-top-padding; padding-top: $page-small-top-padding;
padding-left: $page-side-padding; padding-left: $page-side-padding;
padding-right: $page-side-padding; padding-right: $page-side-padding;
border-bottom: 0.5px solid #ddd; border-bottom: 1px solid #ddd;
.header-item { .header-item {
display: inline-block; display: inline-block;

View File

@ -167,7 +167,7 @@
padding-top: $page-small-top-padding; padding-top: $page-small-top-padding;
padding-left: $page-small-side-padding; padding-left: $page-small-side-padding;
padding-right: $page-small-side-padding; padding-right: $page-small-side-padding;
border-bottom: 0.5px solid #ddd; border-bottom: 1px solid #ddd;
.header-item { .header-item {
display: inline-block; display: inline-block;

View File

@ -31,6 +31,7 @@ export default {
// Tainacan imports // Tainacan imports
@import "../admin/scss/_tables.scss"; @import "../admin/scss/_tables.scss";
@import "../admin/scss/_selects.scss";
@import "../admin/scss/_dropdown-and-autocomplete.scss"; @import "../admin/scss/_dropdown-and-autocomplete.scss";
@import "../admin/scss/_tooltips.scss"; @import "../admin/scss/_tooltips.scss";
@import "../admin/scss/_tainacan-form.scss"; @import "../admin/scss/_tainacan-form.scss";
@ -113,38 +114,6 @@ export default {
border: 1px solid $tainacan-input-background !important; border: 1px solid $tainacan-input-background !important;
} }
} }
.select {
padding-top: 0px !important;
select {
border: none;
border-radius: 1px !important;
font-weight: normal;
font-size: 14px !important;
height: 30px !important;
padding: 2px 25px 2px 15px!important;
margin-top: 0px !important;
margin-bottom: 0px !important;
color: $tainacan-input-color;
option:checked, option:hover {
background-color: $primary-lighter !important;
}
&:focus, &:active {
box-shadow: none !important;
text-decoration: none !important;
}
}
&:not(.is-multiple)::after {
content: "\F35D" !important;
font: normal normal normal 24px/1 "Material Design Icons" !important;
border: none !important;
transform: none !important;
margin-top: -15px !important;
right: 10px !important;
color: $primary;
display: flex !important;
align-items: initial;
}
}
.dropdown { .dropdown {
display: inline-flex; display: inline-flex;
position: relative; position: relative;