Sfoglia il codice sorgente

move basic/agenda view definitions into config files

Adam Shaw 11 anni fa
parent
commit
e2d957dc8c

+ 2 - 4
lumbar.json

@@ -39,11 +39,9 @@
         "src/EventManager.js",
         "src/basic/BasicView.js",
         "src/basic/MonthView.js",
-        "src/basic/BasicWeekView.js",
-        "src/basic/BasicDayView.js",
+        "src/basic/config.js",
         "src/agenda/AgendaView.js",
-        "src/agenda/AgendaWeekView.js",
-        "src/agenda/AgendaDayView.js",
+        "src/agenda/config.js",
         "src/outro.js"
       ],
       "styles": [

+ 0 - 8
src/agenda/AgendaDayView.js

@@ -1,8 +0,0 @@
-
-/* A day view with an all-day cell area at the top, and a time grid below
-----------------------------------------------------------------------------------------------------------------------*/
-
-fcViews.agendaDay = {
-	type: 'agenda',
-	duration: { days: 1 }
-};

+ 1 - 15
src/agenda/AgendaView.js

@@ -4,19 +4,7 @@
 // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
 // Responsible for managing width/height.
 
-var AGENDA_DEFAULTS = {
-	allDaySlot: true,
-	allDayText: 'all-day',
-	scrollTime: '06:00:00',
-	slotDuration: '00:30:00',
-	minTime: '00:00:00',
-	maxTime: '24:00:00',
-	slotEventOverlap: true // a bad name. confused with overlap/constraint system
-};
-
-var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
-
-var AgendaView = fcViews.agenda = View.extend({
+var AgendaView = View.extend({
 
 	timeGrid: null, // the main time-grid subcomponent of this view
 	dayGrid: null, // the "all-day" subcomponent. if all-day is turned off, this will be null
@@ -389,5 +377,3 @@ var AgendaView = fcViews.agenda = View.extend({
 	}
 
 });
-
-AgendaView.defaults = AGENDA_DEFAULTS;

+ 0 - 8
src/agenda/AgendaWeekView.js

@@ -1,8 +0,0 @@
-
-/* A week view with an all-day cell area at the top, and a time grid below
-----------------------------------------------------------------------------------------------------------------------*/
-
-fcViews.agendaWeek = {
-	type: 'agenda',
-	duration: { weeks: 1 }
-};

+ 25 - 0
src/agenda/config.js

@@ -0,0 +1,25 @@
+
+var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
+
+fcViews.agenda = {
+	'class': AgendaView,
+	defaults: {
+		allDaySlot: true,
+		allDayText: 'all-day',
+		scrollTime: '06:00:00',
+		slotDuration: '00:30:00',
+		minTime: '00:00:00',
+		maxTime: '24:00:00',
+		slotEventOverlap: true // a bad name. confused with overlap/constraint system
+	}
+};
+
+fcViews.agendaDay = {
+	type: 'agenda',
+	duration: { days: 1 }
+};
+
+fcViews.agendaWeek = {
+	type: 'agenda',
+	duration: { weeks: 1 }
+};

+ 0 - 8
src/basic/BasicDayView.js

@@ -1,8 +0,0 @@
-
-/* A view with a single simple day cell
-----------------------------------------------------------------------------------------------------------------------*/
-
-fcViews.basicDay = {
-	type: 'basic',
-	duration: { days: 1 }
-};

+ 1 - 1
src/basic/BasicView.js

@@ -4,7 +4,7 @@
 // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
 // It is responsible for managing width/height.
 
-var BasicView = fcViews.basic = View.extend({
+var BasicView = View.extend({
 
 	dayGrid: null, // the main subcomponent that does most of the heavy lifting
 

+ 0 - 8
src/basic/BasicWeekView.js

@@ -1,8 +0,0 @@
-
-/* A week view with simple day cells running horizontally
-----------------------------------------------------------------------------------------------------------------------*/
-
-fcViews.basicWeek = {
-	type: 'basic',
-	duration: { weeks: 1 }
-};

+ 1 - 7
src/basic/MonthView.js

@@ -2,7 +2,7 @@
 /* A month view with day cells running in rows (one-per-week) and columns
 ----------------------------------------------------------------------------------------------------------------------*/
 
-var MonthView = fcViews.month = BasicView.extend({
+var MonthView = BasicView.extend({
 
 	// Produces information about what range to display
 	computeRange: function(date) {
@@ -43,9 +43,3 @@ var MonthView = fcViews.month = BasicView.extend({
 	}
 
 });
-
-MonthView.duration = { months: 1 }; // important for prev/next
-
-MonthView.defaults = {
-	fixedWeekCount: true
-};

+ 22 - 0
src/basic/config.js

@@ -0,0 +1,22 @@
+
+fcViews.basic = {
+	'class': BasicView
+};
+
+fcViews.basicDay = {
+	type: 'basic',
+	duration: { days: 1 }
+};
+
+fcViews.basicWeek = {
+	type: 'basic',
+	duration: { weeks: 1 }
+};
+
+fcViews.month = {
+	'class': MonthView,
+	duration: { months: 1 }, // important for prev/next
+	defaults: {
+		fixedWeekCount: true
+	}
+};