Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "kythor"

Question

Hi,

since working with aspnetzero I have not touched any configuration about Log4Net. But there are no log files in the Logs folder. What do I have to do?

I have added this line in the main HomeController:

Logger.Debug("HomeController - Test: " + Clock.Now.ToString());

but still no log files are generated.

Question

I'm trying to copy the behaviour from MPA into my own frontend (built with Foundation Layout).

I'm struggling with the jTable. What am I missing if this works:

var s1 = abp.localization.localize('Actions');

but this gives error:

title: app.localize('Actions') => app is not defined

Hi,

Since we are offering livestreaming on our site, we would like to prevent viewers to login with the same user credentials at the same time. Is there a simple solution in your architecture to do this?

Idealy it would be something like this:

User A - Login with his credentials User B - Login with User A credentials at the same time => redirect to login page with message "Allready Logged in"

Answer

that seems to work. thx for the help

Question

Hi guys, I want to have a textbox with autocomplete. In a previous project, this worked and showed a dropdown under the textbox with all possible values.

So I added this now to MPA CreateOrEditModel:

<div class="form-group form-md-line-input form-md-floating-label ui-widget">
                        <input id="Tags" class="ui-autocomplete-input form-control@(Model.Article.Tags.IsNullOrEmpty() ? "" : " edited")"
                               type="text" name="Tags" autocomplete="off"
                               value="@Model.Article.Tags">
                        <label>@L("Tags")</label>
                    </div>
                    <script type="text/javascript">
                        $(function () {
                            function split(val) {
                                return val.split(/;\s*/);
                            }
                            function extractLast(term) {
                                return split(term).pop();
                            }
                            $("#Tags")
                            // don't navigate away from the field on tab when selecting an item
                            .bind("keydown", function (event) {
                                if (event.keyCode === $.ui.keyCode.TAB &&
                                $(this).data("ui-autocomplete").menu.active) {
                                    event.preventDefault();
                                }
                            })
                            .autocomplete({
                                source: function (request, response) {
                                    $.ajax({
                                        url: "/mpa/articles/AutocompleteTagSuggestions", type: "POST", dataType: "json",
                                        data: { term: request.term },

                                        success: function (data) {
                                            response($.map(data.result, function (item) {
                                                return { label: item, value: item, id: item };
                                            }));
                                        }
                                    })
                                },
                                search: function () {
                                    // custom minLength
                                    var term = extractLast(this.value);
                                    if (term.length < 2) {
                                        return false;
                                    }
                                },
                                focus: function () {
                                    // prevent value inserted on focus
                                    return false;
                                },
                                select: function (event, ui) {
                                    debugger;
                                    var terms = split(this.value);
                                    // remove the current input
                                    terms.pop();
                                    // add the selected item
                                    terms.push(ui.item.value);
                                    // add placeholder to get the comma-and-space at the end
                                    terms.push("");
                                    this.value = terms.join("; ");
                                    return false;
                                }
                            });
                        });
                    </script>

The ajax calls are working perfect but the dropdown with the results is not showing. This must be a CSS or jQuery UI thing maybe ABP is blocking or overriding? Any ideas?

Success!

I got it to work! This is how:

add to Index.cshtml:

@section Scripts
{
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>

 @Html.IncludeScript("~/Areas/Mpa/Views/Articles/_CreateOrEditModal.js")
    @Html.IncludeScript("~/Areas/Mpa/Views/Articles/Index.js")

<script>
        $(document).on('focusin', function (e) {
            if ($(e.target).closest(".mce-window, .moxman-window").length) {
                e.stopImmediatePropagation();
            }
        });
</script>
}

add this to _CreateOrEditModal.cshtml

<textarea class="form-control tinymce" name="Body" id="Body" tabindex="1" required>@Model.Article.Body</textarea>
                    
                    <script type="text/javascript">
                        for (var i = tinymce.editors.length - 1 ; i > -1 ; i--) {
                            var ed_id = tinymce.editors[i].id;
                            tinyMCE.execCommand("mceRemoveEditor", true, ed_id);
                        }
                        tinymce.init({
                            selector: '#Body',
                            height: 600,
                            theme: 'modern',
                            plugins: [
                              'advlist autolink lists link image charmap preview hr anchor pagebreak',
                              'searchreplace wordcount visualblocks visualchars code fullscreen',
                              'insertdatetime media nonbreaking save table contextmenu directionality',
                              'emoticons template paste textcolor colorpicker textpattern imagetools'
                            ],
                            toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
                            toolbar2: 'preview media | forecolor backcolor emoticons',
                            image_advtab: true,
                            templates: [
                              { title: 'Test template 1', content: 'Test 1' },
                              { title: 'Test template 2', content: 'Test 2' }
                            ],
                            content_css: [
                              '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
                              '//www.tinymce.com/css/codepen.min.css'
                            ]
                        });
                        
                        
                    </script>

I switched to TinyMCE, and I got it working but I had to add this script to Index.html:

$(document).on('focusin', function (e) {
            if ($(e.target).closest(".mce-window, .moxman-window").length) {
                e.stopImmediatePropagation();
            }
        });

now I need to add code to the "open" function of the modal, I tried this, but it doesnt work:

(_permissions.edit) {
                            $('<button class="btn btn-default btn-xs" title="' + app.localize('Edit') + '"><i class="fa fa-edit"></i></button>')
                                .appendTo($span)
                                .click(function () {
                                    debugger;
                                    _createOrEditModal.open({
                                        id: data.record.id
                                        
                                    },
                                    function (event, ui) {
                                        tinyMCE.init({
                                            selector: '#Body',
                                            height: 600,
                                            theme: 'modern'
                                        });
                                    });
                                });
                        }

This is what I did:

  • add <script src="//cdn.ckeditor.com/4.5.11/standard/ckeditor.js"></script> to index.cshtml
  • add this to _createOrEditModel.cshtml
<textarea class="form-control@(Model.Article.Body.IsNullOrEmpty() ? "" : " edited")" name="Body" id="Body" tabindex="1" required>@Model.Article.Body</textarea>
                    
                    <script type="text/javascript">
                                   CKEDITOR.replace('Body');
                    </script>

this will create the CKEditor field without problems. But first thing you will see is that when adding a picture or a link, the extra CKEditor popup will be behind the current modal. This can be "fixed" with adding extra css:

.modal-dialog {
                width:800px !important;
                margin: 30px auto
            }

        .cke_dialog {
            z-index: 1000001 !important;
        }

        .cke_panel {
            z-index: 1000002 !important;
        }

               .cke_skin_v2 input.cke_dialog_ui_input_text, .cke_skin_v2 input.cke_dialog_ui_input_password {
            background-color: white;
            border: none;
            padding: 0;
            width: 100%;
            height: 14px;
            /* new lines */
            position: relative;
            z-index: 1000003 !important;
        }

the ckeditor popup will now display in front of the modal, but you cannot edit the fields. That's where I am stuck for now.

Answer

It works, thanks!

Answer

can you please show me how to add this into this code:

var articles = _articleRepository .GetAll() .OrderByDescending(a => a.ViewCount) .Take(howMany) .ToList();

Showing 81 to 90 of 129 entries