(controller *Controller, method *parser.Function)
| 157 | } |
| 158 | |
| 159 | func (l *loader) loadAction(controller *Controller, method *parser.Function) *Action { |
| 160 | action := new(Action) |
| 161 | action.Name = method.Name() |
| 162 | action.Pascal = gotext.Pascal(action.Name) |
| 163 | action.Camel = gotext.Camel(action.Name) |
| 164 | action.Short = text.Lower(gotext.Short(action.Name)) |
| 165 | action.Route = l.loadActionRoute(controller.Route, action.Name) |
| 166 | action.Key = l.loadActionKey(controller.Path, action.Name) |
| 167 | action.View = l.loadView(controller.Path, action.Key, action.Route) |
| 168 | action.Method = l.loadActionMethod(action.Name) |
| 169 | params := method.Params() |
| 170 | results := method.Results() |
| 171 | action.HandlerFunc = l.isHandlerFunc(params, results) |
| 172 | if !action.HandlerFunc { |
| 173 | action.Params = l.loadActionParams(params) |
| 174 | action.Input = l.loadActionInput(action.Params) |
| 175 | action.Results = l.loadActionResults(results) |
| 176 | } |
| 177 | action.RespondJSON = len(action.Results) > 0 |
| 178 | action.RespondHTML = l.loadRespondHTML(action.Results) |
| 179 | action.Provider = l.loadProvider(controller, method) |
| 180 | action.Redirect = l.loadActionRedirect(action) |
| 181 | return action |
| 182 | } |
| 183 | |
| 184 | func (l *loader) loadActionKey(controllerPath, actionName string) string { |
| 185 | return path.Join(controllerPath, text.Lower(text.Snake(actionName))) |
no test coverage detected