mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
added a name to imported calendar
This commit is contained in:
parent
baf8cfb487
commit
97d93cd622
@ -762,8 +762,8 @@ Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$s
|
||||
* Controller used in the iCalendar (ICS) imports management page
|
||||
*/
|
||||
|
||||
Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCalendars',
|
||||
function ($scope, iCalendars) {
|
||||
Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCalendars', 'ICalendar', 'growl', '_t',
|
||||
function ($scope, iCalendars, ICalendar, growl, _t) {
|
||||
// list of ICS sources
|
||||
$scope.calendars = iCalendars;
|
||||
|
||||
@ -772,6 +772,7 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
|
||||
color: undefined,
|
||||
textColor: undefined,
|
||||
url: undefined,
|
||||
name: undefined,
|
||||
textHidden: false
|
||||
};
|
||||
|
||||
@ -779,11 +780,19 @@ Application.Controllers.controller('AdminICalendarController', ['$scope', 'iCale
|
||||
* Save the new iCalendar in database
|
||||
*/
|
||||
$scope.save = function () {
|
||||
$scope.calendars.push(Object.assign({}, $scope.newCalendar));
|
||||
$scope.newCalendar.url = undefined;
|
||||
$scope.newCalendar.color = null;
|
||||
$scope.newCalendar.textColor = null;
|
||||
$scope.newCalendar.textHidden = false;
|
||||
ICalendar.save({}, { i_calendar: $scope.newCalendar }, function (data) {
|
||||
// success
|
||||
$scope.calendars.push(data);
|
||||
$scope.newCalendar.url = undefined;
|
||||
$scope.newCalendar.name = undefined;
|
||||
$scope.newCalendar.color = null;
|
||||
$scope.newCalendar.textColor = null;
|
||||
$scope.newCalendar.textHidden = false;
|
||||
}, function (error) {
|
||||
// failed
|
||||
growl.error(_t('icalendar.create_error'));
|
||||
console.error(error);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,3 +8,12 @@
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar-name {
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.calendar-url {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
@ -30,14 +30,16 @@
|
||||
<table class="table" ng-show="calendars.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 75%;" translate>{{ 'icalendar.url' }}</th>
|
||||
<th style="width: 35%;" translate>{{ 'icalendar.name' }}</th>
|
||||
<th style="width: 35%;" translate>{{ 'icalendar.url' }}</th>
|
||||
<th translate>{{ 'icalendar.display' }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="calendar in calendars">
|
||||
<td class="calendar-url">{{calendar.url}}</td>
|
||||
<td class="calendar-name">{{calendar.name}}</td>
|
||||
<td class="calendar-url"><a href="{{calendar.url}}" target="_blank">{{calendar.url}}</a></td>
|
||||
<td class="calendar-legend-block text-left"><span class="calendar-legend" ng-style="calendarStyle(calendar)" translate> {{ calendar.textHidden ? '' : 'icalendar.example' }}</span>
|
||||
<td class="calendar-actions">
|
||||
<button class="btn btn-danger" ng-click="delete(calendar)"><i class="fa fa-trash"></i></button>
|
||||
@ -47,6 +49,12 @@
|
||||
</table>
|
||||
<form class="calendar-form" name="newImportForm">
|
||||
<h4 translate>{{ 'icalendar.new_import' }}</h4>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-font"></i>
|
||||
</div>
|
||||
<input type="text" ng-model="newCalendar.name" class="form-control" placeholder="{{ 'icalendar.name' | translate }}" required>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<i class="fa fa-link"></i>
|
||||
|
@ -50,6 +50,6 @@ class API::ICalendarController < API::ApiController
|
||||
end
|
||||
|
||||
def i_calendar_params
|
||||
params.require(:i_calendar).permit(:url, :color, :text_color, :text_hidden)
|
||||
params.require(:i_calendar).permit(:name, :url, :color, :text_color, :text_hidden)
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.extract! i_cal, :id, :url, :color, :text_color, :text_hidden
|
||||
json.extract! i_cal, :id, :name, :url, :color, :text_color, :text_hidden
|
||||
|
@ -96,11 +96,13 @@ fr:
|
||||
color: "Couleur"
|
||||
text_color: "Couleur du texte"
|
||||
url: "URL"
|
||||
name: "Nom"
|
||||
example: "Exemple"
|
||||
display: "Affichage"
|
||||
hide_text: "Cacher le texte"
|
||||
hidden: "Caché"
|
||||
shown: "Affiché"
|
||||
create_error: "Impossible de créer l'import iCalendar. Veuillez réessayer ultérieurement"
|
||||
|
||||
project_elements:
|
||||
# gestion des éléments constituant les projets
|
||||
|
@ -6,6 +6,7 @@ class CreateICalendars < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :i_calendars do |t|
|
||||
t.string :url
|
||||
t.string :name
|
||||
t.string :color
|
||||
t.string :text_color
|
||||
t.boolean :text_hidden
|
||||
|
@ -253,6 +253,7 @@ ActiveRecord::Schema.define(version: 20191127153729) do
|
||||
|
||||
create_table "i_calendars", force: :cascade do |t|
|
||||
t.string "url"
|
||||
t.string "name"
|
||||
t.string "color"
|
||||
t.string "text_color"
|
||||
t.boolean "text_hidden"
|
||||
|
Loading…
x
Reference in New Issue
Block a user