| @@ -214,7 +214,7 @@ func TestCreateMeeting(t *testing.T) { | |||
| AssertEqual(t, newMeeting.Status, "Planned", "meeting status is planned") | |||
| AssertEqual(t, newMeeting.ParentName, "", "parentName not expected to be updated") | |||
| entity, err := crmFindEntityByID("Meeting", newMeeting.ID) | |||
| entity, err := crmGetEntity("Meeting", newMeeting.ID) | |||
| AssertEqual(t, err, nil, "re read saved meeting should be ok") | |||
| anotherRead, ok := entity.(crmdMeeting) | |||
| AssertEqual(t, ok, true, "reading entity shold be crmdMeeting") | |||
| @@ -41,6 +41,9 @@ type crmdMeeting struct { | |||
| //cover | |||
| CoverID string `json:"coverId,omitempty"` | |||
| CoverName string `json:"coverName,omitempty"` | |||
| //for web spa operation | |||
| spaErrMsg string | |||
| } | |||
| func (m crmdMeeting) save() (newMeeting crmdMeeting, err error) { | |||
| @@ -67,3 +70,11 @@ func (m crmdMeeting) save() (newMeeting crmdMeeting, err error) { | |||
| } | |||
| return | |||
| } | |||
| func (m *crmdMeeting) setSpaErr(e string) { | |||
| m.spaErrMsg = e | |||
| } | |||
| func (m crmdMeeting) ErrorMessage() string { | |||
| return m.spaErrMsg | |||
| } | |||
| @@ -1,10 +0,0 @@ | |||
| package main | |||
| import ( | |||
| "fmt" | |||
| "net/http" | |||
| ) | |||
| func editMeetingHandler(w http.ResponseWriter, r *http.Request) { | |||
| fmt.Fprintf(w, "ok meeting handled") | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package main | |||
| import ( | |||
| "fmt" | |||
| "html/template" | |||
| "io/ioutil" | |||
| "log" | |||
| "net/http" | |||
| ) | |||
| func spaEditMeetingHandler(w http.ResponseWriter, r *http.Request) { | |||
| //fmt.Fprintf(w, "ok meeting handled") | |||
| e, err := crmGetEntity("Meeting", "595d064a6e372fc1f") | |||
| log.Println(err) | |||
| meeting, ok := e.(crmdMeeting) | |||
| log.Println(ok) | |||
| spaEditMeetingPopulateMeetingInfo(w, meeting) | |||
| } | |||
| func spaEditMeetingPopulateMeetingInfo(w http.ResponseWriter, meeting crmdMeeting) { | |||
| tTest := template.New("spaEditMeeting") | |||
| str, err := ioutil.ReadFile("spa/editmeeting.html") | |||
| if err != nil { | |||
| w.WriteHeader(http.StatusInternalServerError) | |||
| fmt.Fprintf(w, "Formating information not available.") | |||
| return | |||
| } | |||
| tTest, err = tTest.Parse(string(str)) | |||
| if err != nil { | |||
| w.WriteHeader(http.StatusInternalServerError) | |||
| fmt.Fprintf(w, "Formating instruction invalid") | |||
| return | |||
| } | |||
| err = tTest.Execute(w, meeting) | |||
| if err != nil { | |||
| w.WriteHeader(http.StatusInternalServerError) | |||
| fmt.Fprintf(w, "Monkey runs into our computer room...") | |||
| log.Println("ERROR: Template execution on spa/Edit, failed \n" + err.Error()) | |||
| } | |||
| } | |||
| @@ -15,7 +15,7 @@ type crmdLiveCast struct { | |||
| Description string `json:"description,omitempty"` | |||
| } | |||
| func liveCastHandler(w http.ResponseWriter, r *http.Request) { | |||
| func spaLiveCastHandler(w http.ResponseWriter, r *http.Request) { | |||
| castID := "" | |||
| q, err := url.ParseQuery(r.URL.RawQuery) | |||
| if err == nil { | |||
| @@ -31,7 +31,7 @@ func liveCastHandler(w http.ResponseWriter, r *http.Request) { | |||
| } | |||
| //castID = "5967812b87eb10564" | |||
| entity, err := crmFindEntityByID("Livecast", castID) | |||
| entity, err := crmGetEntity("Livecast", castID) | |||
| if err != nil || entity == nil { | |||
| response404Handler(w) | |||
| return | |||
| @@ -65,8 +65,8 @@ func setupHTTPHandler() { | |||
| http.HandleFunc("/crmpixel.png", crmpixel) //tracking pixel. | |||
| http.HandleFunc("/crmcache", crmcache) | |||
| http.HandleFunc("/spa/editprofile", spaEditProfile) | |||
| http.HandleFunc("/spa/livecast", liveCastHandler) | |||
| http.HandleFunc("/spa/editmeeting", editMeetingHandler) | |||
| http.HandleFunc("/spa/livecast", spaLiveCastHandler) | |||
| http.HandleFunc("/spa/editmeeting", spaEditMeetingHandler) | |||
| http.ListenAndServe(":65500", nil) | |||
| } | |||
| @@ -36,7 +36,7 @@ function closeWechatBrowser(){ | |||
| } | |||
| $(document).ready(function() { | |||
| console.log("ready"); | |||
| $('.datepicker').pickadate({ | |||
| format: 'mm/dd/yyyy', | |||
| selectMonths: true, // Creates a dropdown to control month | |||
| @@ -58,6 +58,8 @@ $(document).ready(function() { | |||
| $('#modalerr').modal('open'); | |||
| } | |||
| $("textarea").height( $("textarea")[0].scrollHeight ); | |||
| console.log("spa ready"); | |||
| }); | |||
| $("form").submit(function(event){ | |||
| @@ -30,14 +30,14 @@ | |||
| <div class="row"> | |||
| <div class="input-field col s12"> | |||
| <i class="mdi-action-loyalty small prefix"></i> | |||
| <input name="meetingname" id="meetingname" type="text" class="validate"> | |||
| <input name="meetingname" id="meetingname" type="text" class="validate" value="{{.Name}}"> | |||
| <label for="meetingname"> 活动主题/标题 (30字以内) </label> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="input-field col s12"> | |||
| <i class="mdi-action-list small prefix"></i> | |||
| <textarea id="description" name="description" class="materialize-textarea"></textarea> | |||
| <textarea id="description" name="description" class="materialize-textarea">{{.Description}}</textarea> | |||
| <label for="description"> | |||
| 活动描述 200字左右 | |||
| </label> | |||
| @@ -1 +1 @@ | |||
| {"files":{"edit.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":896},"404.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"livecast.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newEvents.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newevent.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["28.875em","33.875em","35.875em","38.875em","40.125em","46.75em","360px","390px","420px","450px","480px","510px","540px","570px","601px","630px","660px","690px","720px","750px","780px","810px","840px","870px","900px","930px","960px","993px","1200px"],"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"template_framework_id":"materialize"} | |||
| {"files":{"edit.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":896},"404.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.asset.manager","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"livecast.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newEvents.html":{"frameworks":["spa","pg.insight.events","pg.code-validator","pg.project.items","pg.asset.manager","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"newevent.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024},"editmeeting.html":{"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["28.875em","33.875em","35.875em","38.875em","40.125em","46.75em","360px","390px","420px","450px","480px","510px","540px","570px","601px","630px","660px","690px","720px","750px","780px","810px","840px","870px","900px","930px","960px","993px","1200px"],"frameworks":["spa","pg.insight.events","pg.asset.manager","pg.code-validator","pg.project.items","mat0.97.5","pg.html","pg.components"],"template_framework_id":"materialize"} | |||