diff --git a/drupal-org.make b/drupal-org.make index 13667bed..f73df561 100644 --- a/drupal-org.make +++ b/drupal-org.make @@ -484,6 +484,9 @@ projects[title][version] = 1.0-alpha9 projects[token][version] = 1.7 +projects[user_notifications][version] = 2.x-dev +projects[user_notifications][patch][] = https://www.drupal.org/files/issues/user_notifications-2926012-1.patch + projects[userone][version] = 1.0-beta1 projects[uuid][version] = 1.0 @@ -527,6 +530,8 @@ projects[views_megarow][version] = 1.7 projects[views_php][version] = 1.0-alpha3 +projects[views_refresh][version] = 1.2 + projects[votingapi][version] = 2.12 projects[votingapi][patch][] = https://www.drupal.org/files/issues/updating_voting_api_default_views-2679585-3.patch diff --git a/modules/roomify/roomify_dashboard/roomify_dashboard.info b/modules/roomify/roomify_dashboard/roomify_dashboard.info index af966164..ef2da885 100644 --- a/modules/roomify/roomify_dashboard/roomify_dashboard.info +++ b/modules/roomify/roomify_dashboard/roomify_dashboard.info @@ -28,6 +28,7 @@ features[panels_mini][] = dashboard_welcome features[views_view][] = availability_calendar features[views_view][] = dashboard_bookings features[views_view][] = dashboard_guest_stays +features[views_view][] = dashboard_notifications features[views_view][] = email_templates features[views_view][] = favorite_properties features[views_view][] = form_submissions @@ -38,3 +39,4 @@ files[] = views/roomify_dashboard_filters_handler_filter_language_select.inc files[] = views/roomify_dashboard_handler_localized_edit_link.inc files[] = views/roomify_dashboard_handler_properties_types_edit_link.inc files[] = views/roomify_dashboard_handler_bat_booking_price.inc +files[] = views/roomify_dashboard_handler_hide_notification.inc diff --git a/modules/roomify/roomify_dashboard/roomify_dashboard.module b/modules/roomify/roomify_dashboard/roomify_dashboard.module index 4704c301..8a1f7afa 100644 --- a/modules/roomify/roomify_dashboard/roomify_dashboard.module +++ b/modules/roomify/roomify_dashboard/roomify_dashboard.module @@ -20,6 +20,23 @@ function roomify_dashboard_menu() { 'access arguments' => array('administer theme colors'), ); + $items['user-notifications/%user_notifications/hide'] = array( + 'delivery callback' => 'ajax_deliver', + 'page callback' => 'roomify_dashboard_hide_user_notification', + 'page arguments' => array(1), + 'access callback' => 'roomify_dashboard_hide_user_notification_access', + 'access arguments' => array(1), + 'type' => MENU_CALLBACK, + ); + + $items['user-notifications/hide-all'] = array( + 'delivery callback' => 'ajax_deliver', + 'page callback' => 'roomify_dashboard_hide_all_user_notification', + 'page arguments' => array(1), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); + return $items; } @@ -153,6 +170,31 @@ function roomify_dashboard_views_pre_render(&$view) { $view->exposed_widgets = FALSE; } } + + if ($view->name == 'dashboard_notifications') { + global $user; + + $query = new EntityFieldQuery(); + + $query->entityCondition('entity_type', 'user_notifications') + ->propertyCondition('state', 'unseen') + ->fieldCondition('user_notifications_recipient_uid', 'target_id', $user->uid) + ->propertyOrderBy('created', 'DESC') + ->range(0, 1); + + $last_user_notification = $query->execute(); + + if (!empty($last_user_notification)) { + $last_user_notifications_id = key($last_user_notification['user_notifications']); + + if (!isset($user->data['last_user_notifications_id']) || $user->data['last_user_notifications_id'] < $last_user_notifications_id) { + $view->set_title($view->get_title() . '
'); + + $user->data['last_user_notifications_id'] = $last_user_notifications_id; + user_save($user); + } + } + } } /** @@ -361,6 +403,14 @@ function roomify_dashboard_views_data_alter(&$data) { 'handler' => 'roomify_dashboard_handler_properties_types_edit_link', ), ); + + $data['user_notifications']['hide'] = array( + 'field' => array( + 'title' => t('Hide notification'), + 'help' => t('Hide notification'), + 'handler' => 'roomify_dashboard_handler_hide_notification', + ), + ); } /** @@ -558,3 +608,58 @@ function roomify_dashboard_views_query_alter(&$view, &$query) { } } } + +/** + * Hide user notification access callback. + */ +function roomify_dashboard_hide_user_notification_access($user_notification) { + global $user; + + if ($user_notification->wrapper->user_notifications_recipient_uid->uid->value() == $user->uid) { + return TRUE; + } + + return FALSE; +} + +/** + * Hide user notification. + */ +function roomify_dashboard_hide_user_notification($user_notification) { + $user_notification->update_state('seen'); + + $commands = array(); + + $commands[] = views_refresh_ajax_command_refresh('.view-dashboard-notifications'); + + return array( + '#type' => 'ajax', + '#commands' => $commands, + ); +} + +function roomify_dashboard_hide_all_user_notification() { + global $user; + + $query = new EntityFieldQuery(); + $query->entityCondition('entity_type', 'user_notifications'); + $query->propertyCondition('state', 'unseen'); + $query->fieldCondition('user_notifications_recipient_uid', 'target_id', $user->uid); + + $results = $query->execute(); + if (isset($results['user_notifications'])) { + foreach ($results['user_notifications'] as $result) { + $user_notification = user_notifications_load($result->user_notifications_id); + $user_notification->update_state('seen'); + } + } + + $commands = array(); + + $commands[] = views_refresh_ajax_command_refresh('.view-dashboard-notifications'); + + return array( + '#type' => 'ajax', + '#commands' => $commands, + ); +} diff --git a/modules/roomify/roomify_dashboard/roomify_dashboard.panels_default.inc b/modules/roomify/roomify_dashboard/roomify_dashboard.panels_default.inc index 3f22c62a..f1f93f25 100644 --- a/modules/roomify/roomify_dashboard/roomify_dashboard.panels_default.inc +++ b/modules/roomify/roomify_dashboard/roomify_dashboard.panels_default.inc @@ -1597,6 +1597,7 @@ function roomify_dashboard_default_panels_mini() { ), 'middle' => NULL, 'bottom' => NULL, + 'middle-second' => NULL, ), 'top' => array( 'style' => 'tabs', @@ -1826,6 +1827,28 @@ function roomify_dashboard_default_panels_mini() { $pane->uuid = 'c58443f0-5efd-440c-916a-c5b8bcbdc63d'; $display->content['new-c58443f0-5efd-440c-916a-c5b8bcbdc63d'] = $pane; $display->panels['top'][6] = 'new-c58443f0-5efd-440c-916a-c5b8bcbdc63d'; + $pane = new stdClass(); + $pane->pid = 'new-9c03ae9f-5f7e-43fc-8af3-9bee26ba71d7'; + $pane->panel = 'top'; + $pane->type = 'views_panes'; + $pane->subtype = 'dashboard_notifications-panel_pane_1'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array(); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array( + 'css_id' => '', + 'css_class' => 'col-xs-12', + ); + $pane->extras = array(); + $pane->position = 7; + $pane->locks = array(); + $pane->uuid = '9c03ae9f-5f7e-43fc-8af3-9bee26ba71d7'; + $display->content['new-9c03ae9f-5f7e-43fc-8af3-9bee26ba71d7'] = $pane; + $display->panels['top'][7] = 'new-9c03ae9f-5f7e-43fc-8af3-9bee26ba71d7'; $display->hide_title = PANELS_TITLE_FIXED; $display->title_pane = '0'; $mini->display = $display; diff --git a/modules/roomify/roomify_dashboard/roomify_dashboard.views_default.inc b/modules/roomify/roomify_dashboard/roomify_dashboard.views_default.inc index 870b1b78..670b6e5e 100644 --- a/modules/roomify/roomify_dashboard/roomify_dashboard.views_default.inc +++ b/modules/roomify/roomify_dashboard/roomify_dashboard.views_default.inc @@ -4423,5 +4423,111 @@ function roomify_dashboard_views_default_views() { ); $export['roomify_user_orders'] = $view; + $view = new view(); + $view->name = 'dashboard_notifications'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'user_notifications'; + $view->human_name = 'Dashboard notifications'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'Notifications'; + $handler->display->display_options['use_ajax'] = TRUE; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'none'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'mini'; + $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['pager']['options']['id'] = '0'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Header: Global: Text area */ + $handler->display->display_options['header']['area']['id'] = 'area'; + $handler->display->display_options['header']['area']['table'] = 'views'; + $handler->display->display_options['header']['area']['field'] = 'area'; + $handler->display->display_options['header']['area']['content'] = 'Hide all'; + $handler->display->display_options['header']['area']['format'] = 'filtered_text'; + /* No results behavior: Global: Text area */ + $handler->display->display_options['empty']['area']['id'] = 'area'; + $handler->display->display_options['empty']['area']['table'] = 'views'; + $handler->display->display_options['empty']['area']['field'] = 'area'; + $handler->display->display_options['empty']['area']['empty'] = TRUE; + $handler->display->display_options['empty']['area']['content'] = 'No notifications to read.'; + $handler->display->display_options['empty']['area']['format'] = 'filtered_text'; + /* Field: User notification: Hide notification */ + $handler->display->display_options['fields']['hide']['id'] = 'hide'; + $handler->display->display_options['fields']['hide']['table'] = 'user_notifications'; + $handler->display->display_options['fields']['hide']['field'] = 'hide'; + $handler->display->display_options['fields']['hide']['label'] = ''; + $handler->display->display_options['fields']['hide']['element_label_colon'] = FALSE; + /* Field: User notification: User Notification type */ + $handler->display->display_options['fields']['type']['id'] = 'type'; + $handler->display->display_options['fields']['type']['table'] = 'user_notifications'; + $handler->display->display_options['fields']['type']['field'] = 'type'; + $handler->display->display_options['fields']['type']['label'] = ''; + $handler->display->display_options['fields']['type']['element_label_colon'] = FALSE; + /* Field: User notification: New Message */ + $handler->display->display_options['fields']['user_notifications_message']['id'] = 'user_notifications_message'; + $handler->display->display_options['fields']['user_notifications_message']['table'] = 'field_data_user_notifications_message'; + $handler->display->display_options['fields']['user_notifications_message']['field'] = 'user_notifications_message'; + $handler->display->display_options['fields']['user_notifications_message']['label'] = ''; + $handler->display->display_options['fields']['user_notifications_message']['element_label_colon'] = FALSE; + $handler->display->display_options['fields']['user_notifications_message']['settings'] = array( + 'conditions' => array( + 0 => array( + 'condition' => '', + ), + ), + ); + /* Contextual filter: User notification: Notification Recipient (user_notifications_recipient_uid) */ + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['id'] = 'user_notifications_recipient_uid_target_id'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['table'] = 'field_data_user_notifications_recipient_uid'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['field'] = 'user_notifications_recipient_uid_target_id'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['default_action'] = 'default'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['default_argument_type'] = 'current_user'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['summary']['number_of_records'] = '0'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['summary']['format'] = 'default_summary'; + $handler->display->display_options['arguments']['user_notifications_recipient_uid_target_id']['summary_options']['items_per_page'] = '25'; + /* Filter criterion: User notification: State entity */ + $handler->display->display_options['filters']['state']['id'] = 'state'; + $handler->display->display_options['filters']['state']['table'] = 'user_notifications'; + $handler->display->display_options['filters']['state']['field'] = 'state'; + $handler->display->display_options['filters']['state']['value'] = array( + 'unseen' => 'unseen', + ); + + /* Display: Content pane */ + $handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1'); + $translatables['dashboard_notifications'] = array( + t('Master'), + t('Notifications'), + t('more'), + t('Apply'), + t('Reset'), + t('Sort by'), + t('Asc'), + t('Desc'), + t('Items per page'), + t('- All -'), + t('Offset'), + t('« first'), + t('‹ previous'), + t('next ›'), + t('last »'), + t('Hide all'), + t('No notifications to read.'), + t('All'), + t('Content pane'), + t('View panes'), + ); + $export['dashboard_notifications'] = $view; + return $export; } diff --git a/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_bat_booking_price.inc b/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_bat_booking_price.inc index 351df2cc..ba8869d6 100644 --- a/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_bat_booking_price.inc +++ b/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_bat_booking_price.inc @@ -28,7 +28,6 @@ class roomify_dashboard_handler_bat_booking_price extends views_handler_field { * {@inheritdoc} */ public function render($values) { - // Standard Booking. if (isset($values->field_booking_price) && (!empty($values->field_booking_price[0]['rendered']['#markup']))) { return $values->field_booking_price[0]['rendered']['#markup']; diff --git a/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_hide_notification.inc b/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_hide_notification.inc new file mode 100644 index 00000000..b4775f38 --- /dev/null +++ b/modules/roomify/roomify_dashboard/views/roomify_dashboard_handler_hide_notification.inc @@ -0,0 +1,35 @@ +ensure_my_table(); + } + + /** + * {@inheritdoc} + */ + public function render($values) { + $user_notification = $this->get_value($values); + + return l(t('Hide'), 'user-notifications/' . $user_notification->user_notifications_id . '/hide', array('attributes' => array('class' => 'use-ajax'))); + } + +} diff --git a/modules/roomify/roomify_system/roomify_system.info b/modules/roomify/roomify_system/roomify_system.info index e41378db..46e1bd81 100644 --- a/modules/roomify/roomify_system/roomify_system.info +++ b/modules/roomify/roomify_system/roomify_system.info @@ -10,6 +10,7 @@ dependencies[] = file_entity dependencies[] = panels dependencies[] = panels_mini dependencies[] = logintoboggan +dependencies[] = user_notifications dependencies[] = variable_realm files[] = views/roomify_system_handler_edit_link_field.inc diff --git a/modules/roomify/roomify_system/roomify_system.install b/modules/roomify/roomify_system/roomify_system.install index ffe6d321..9a7afa53 100644 --- a/modules/roomify/roomify_system/roomify_system.install +++ b/modules/roomify/roomify_system/roomify_system.install @@ -23,6 +23,77 @@ function roomify_system_install() { roomify_system_add_user_fields(); roomify_system_setup_advagg(); + + roomify_system_create_notification_types(); +} + +/** + * Create notification types. + */ +function roomify_system_create_notification_types() { + $user_notifications_types = array( + array( + 'name' => 'channel_manager_conflict', + 'label' => 'Channel manager conflict', + 'locked' => 1, + ), + array( + 'name' => 'new_booking', + 'label' => 'New Booking', + 'locked' => 1, + ), + array( + 'name' => 'new_conversation', + 'label' => 'New Conversation', + 'locked' => 1, + ), + array( + 'name' => 'new_conversation_message', + 'label' => 'New Conversation Message', + 'locked' => 1, + ), + ); + + foreach ($user_notifications_types as $info) { + if (empty(entity_load_multiple_by_name('user_notifications_type', array($info['name'])))) { + $user_notifications_type = entity_get_controller('user_notifications_type')->create($info); + $user_notifications_type->save(); + + $instance = array( + 'bundle' => $info['name'], + 'default_value' => NULL, + 'deleted' => 0, + 'description' => 'Enter a message that will be displayed to a user as a notification.', + 'display' => array( + 'default' => array( + 'label' => 'above', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => 2, + ), + ), + 'entity_type' => 'user_notifications', + 'field_name' => 'user_notifications_message', + 'label' => 'New Message', + 'required' => 1, + 'settings' => array( + 'text_processing' => 0, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'text', + 'settings' => array( + 'rows' => 5, + ), + 'type' => 'text_textarea', + 'weight' => 3, + ), + ); + field_create_instance($instance); + } + } } /** @@ -996,3 +1067,24 @@ function roomify_system_update_7062() { function roomify_system_update_7063() { module_enable(array('xmlsitemap_menu')); } + +/** + * Enable module "User Notifications". + */ +function roomify_system_update_7064() { + module_enable(array('user_notifications')); +} + +/** + * Create notification types. + */ +function roomify_system_update_7065() { + roomify_system_create_notification_types(); +} + +/** + * Enable module "Views Refresh". + */ +function roomify_system_update_7066() { + module_enable(array('views_refresh')); +} diff --git a/roomify.info b/roomify.info index a9537410..9e8cf544 100644 --- a/roomify.info +++ b/roomify.info @@ -53,6 +53,7 @@ dependencies[] = i18n_panels dependencies[] = views_content dependencies[] = views dependencies[] = views_data_export +dependencies[] = views_refresh ; Rules dependencies[] = rules @@ -138,6 +139,7 @@ dependencies[] = hreflang dependencies[] = select2 dependencies[] = yoast_seo dependencies[] = video +dependencies[] = user_notifications ; Users dependencies[] = profile2 diff --git a/themes/roomify/roomify_adminimal_theme/css/roomify_adminimal_theme.css b/themes/roomify/roomify_adminimal_theme/css/roomify_adminimal_theme.css index 2fc1755a..d982eb4c 100644 --- a/themes/roomify/roomify_adminimal_theme/css/roomify_adminimal_theme.css +++ b/themes/roomify/roomify_adminimal_theme/css/roomify_adminimal_theme.css @@ -1,3 +1,5 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:400,300,700); +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,800,700); .btn-circle { width: 30px; height: 30px; @@ -2683,6 +2685,32 @@ body.adminimal-skin-material table.views-table tbody tr td { top: 15px; } } +.roomify-dashboard #notifications-tab { + background: url("../images/dashboard/notification.png") center center no-repeat; + background: url("../images/dashboard/notification.svg") center center no-repeat, linear-gradient(transparent, transparent); + display: inline-block; + width: 18px; + height: 18px; + position: relative; + top: 4px; + right: 6px; +} +@media (max-width: 991px) { + .roomify-dashboard #notifications-tab { + position: absolute; + left: 20px; + top: 15px; + } +} +.roomify-dashboard #notifications-to-read { + background: red; + width: 10px; + height: 10px; + border-radius: 5px; + position: absolute; + top: 4px; + right: 4px; +} .roomify-dashboard #dashboard-stays-tab { background: url("../images/dashboard/reservation.png") center center no-repeat; background: url("../images/dashboard/reservation.svg") center center no-repeat, linear-gradient(transparent, transparent); @@ -2717,6 +2745,40 @@ body.adminimal-skin-material table.views-table tbody tr td { top: 15px; } } +.pane-dashboard-notifications-panel-pane-1 .ajax-progress { + display: none; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .view-header { + margin-bottom: 15px; + width: 100%; + display: inline-block; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .view-header a { + float: right; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .views-row { + color: white; + margin-bottom: 15px; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .views-row .views-field-type { + padding: 5px 12px; + background: #405467; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .views-row .views-field-user-notifications-message { + padding: 7px 12px; + background: #687c90; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .views-row .views-field-hide { + float: right; + margin: 5px 8px; +} +.pane-dashboard-notifications-panel-pane-1 .view-dashboard-notifications .views-row .views-field-hide a { + display: block; + text-indent: -999999px; + width: 24px; + background: url('../images/close.png') center center no-repeat; + background-size: 10px; +} .page-admin-bat-config-booking-add-roomify-accommodation-booking #bat-booking-edit-form .field-name-booking-end-date, #bat-booking-edit-roomify-accommodation-booking-form .field-name-booking-end-date, .page-admin-bat-config-booking-add-roomify-accommodation-booking #bat-booking-edit-form .field-name-booking-start-date, @@ -3455,42 +3517,6 @@ body.adminimal-skin-material .vertical-tabs-panes fieldset.vertical-tabs-pane { line-height: 33px; } /* Custom font */ -@font-face { - font-family: 'Lato'; - font-style: normal; - font-weight: 300; - src: local('Lato Light'), local('Lato-Light'), url(https://fonts.gstatic.com/s/lato/v14/nj47mAZe0mYUIySgfn0wpQ.ttf) format('truetype'); -} -@font-face { - font-family: 'Lato'; - font-style: normal; - font-weight: 400; - src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v14/v0SdcGFAl2aezM9Vq_aFTQ.ttf) format('truetype'); -} -@font-face { - font-family: 'Lato'; - font-style: normal; - font-weight: 700; - src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v14/DvlFBScY1r-FMtZSYIYoYw.ttf) format('truetype'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/s/opensans/v15/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf) format('truetype'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 700; - src: local('Open Sans Bold'), local('OpenSans-Bold'), url(https://fonts.gstatic.com/s/opensans/v15/k3k702ZOKiLJc3WVjuplzInF5uFdDttMLvmWuJdhhgs.ttf) format('truetype'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 800; - src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'), url(https://fonts.gstatic.com/s/opensans/v15/EInbV5DfGHOiMmvb1Xr-honF5uFdDttMLvmWuJdhhgs.ttf) format('truetype'); -} #references-dialog-page { background: white; } diff --git a/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.png b/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.png new file mode 100644 index 00000000..e623fdaf Binary files /dev/null and b/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.png differ diff --git a/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.svg b/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.svg new file mode 100644 index 00000000..65c5ed0b --- /dev/null +++ b/themes/roomify/roomify_adminimal_theme/images/dashboard/notification.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/themes/roomify/roomify_adminimal_theme/js/roomify_adminimal_theme.js b/themes/roomify/roomify_adminimal_theme/js/roomify_adminimal_theme.js index 39f36cbc..5c5b2dfc 100644 --- a/themes/roomify/roomify_adminimal_theme/js/roomify_adminimal_theme.js +++ b/themes/roomify/roomify_adminimal_theme/js/roomify_adminimal_theme.js @@ -37,6 +37,14 @@ Drupal.behaviors.roomify_admin_js = { if (('table tbody td a.references-dialog-activate.waves-effect').length > 0) { $('table tbody td a.references-dialog-activate.waves-effect').removeClass('waves-effect'); } + + $('.view-dashboard-notifications .views-field-hide a').once().click(function() { + $(this).closest('.views-row').fadeOut('slow'); + }); + $('.view-dashboard-notifications .hide-all').once().click(function() { + $(this).closest('.view').find('.view-content').fadeOut('slow'); + $(this).closest('.view').find('ul.pager').fadeOut('slow'); + }); } }; diff --git a/themes/roomify/roomify_adminimal_theme/less/components/dashboard.less b/themes/roomify/roomify_adminimal_theme/less/components/dashboard.less index 943f3879..6b30a9f9 100644 --- a/themes/roomify/roomify_adminimal_theme/less/components/dashboard.less +++ b/themes/roomify/roomify_adminimal_theme/less/components/dashboard.less @@ -385,6 +385,30 @@ top: 15px; } } + #notifications-tab { + background: url("../images/dashboard/notification.png") center center no-repeat; + background: url("../images/dashboard/notification.svg") center center no-repeat, linear-gradient(transparent, transparent); + display: inline-block; + width: 18px; + height: 18px; + position: relative; + top: 4px; + right: 6px; + @media (max-width: @screen-sm-max) { + position: absolute; + left: 20px; + top: 15px; + } + } + #notifications-to-read { + background: red; + width: 10px; + height: 10px; + border-radius: 5px; + position: absolute; + top: 4px; + right: 4px; + } #dashboard-stays-tab { background: url("../images/dashboard/reservation.png") center center no-repeat; background: url("../images/dashboard/reservation.svg") center center no-repeat, linear-gradient(transparent, transparent); @@ -416,3 +440,42 @@ } } } + +.pane-dashboard-notifications-panel-pane-1 { + .ajax-progress { + display: none; + } + .view-dashboard-notifications { + .view-header { + margin-bottom: 15px; + width: 100%; + display: inline-block; + a { + float: right; + } + } + .views-row { + color: white; + margin-bottom: 15px; + .views-field-type { + padding: 5px 12px; + background: #405467; + } + .views-field-user-notifications-message { + padding: 7px 12px; + background: #687c90; + } + .views-field-hide { + float: right; + margin: 5px 8px; + a { + display: block; + text-indent: -999999px; + width: 24px; + background: url('../images/close.png') center center no-repeat; + background-size: 10px; + } + } + } + } +} diff --git a/themes/roomify/roomify_adminimal_theme/templates/views-view-field--dashboard-notifications--type.tpl.php b/themes/roomify/roomify_adminimal_theme/templates/views-view-field--dashboard-notifications--type.tpl.php new file mode 100644 index 00000000..e7641625 --- /dev/null +++ b/themes/roomify/roomify_adminimal_theme/templates/views-view-field--dashboard-notifications--type.tpl.php @@ -0,0 +1,28 @@ +{$field->field_alias} + * + * The above will guarantee that you'll always get the correct data, + * regardless of any changes in the aliasing that might happen if + * the view is modified. + */ +?> +label; +?>